OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [reshape.f90] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
! This tests a few reshape PRs.
3
program resh
4
  implicit none
5
  real, dimension (2,3) :: a,c
6
  real, dimension (12) :: b
7
  type foo
8
    real :: r
9
  end type foo
10
  type(foo), dimension (2,3) :: ar
11
  type(foo), dimension (12) :: br
12
 
13
  character (len=80) line1, line2, line3
14
  integer :: i
15
 
16
  ! PR 21108:  This used to give undefined results.
17
  b = (/(i,i=1,12)/)
18
  a = reshape(b(1:12:2),shape(a),order=(/2,1/))
19
  c = reshape(b(1:12:2),shape(a),order=(/2,1/))
20
  if (any (a /= c)) call abort
21
 
22
  ! Test generic reshape
23
  br%r = b
24
  ar = reshape(br(1:12:2),shape(a),order=(/2,1/))
25
  if (any (ar%r /= a)) call abort
26
 
27
  ! Test callee-allocated memory with a write statement
28
  write (line1,'(6F8.3)') reshape(b(1:12:2),shape(a),order=(/2,1/))
29
  write (line2,'(6F8.3)') a
30
  if (line1 /= line2 ) call abort
31
  write (line3,'(6F8.3)') reshape(br(1:12:2),shape(ar),order=(/2,1/))
32
  if (line1 /= line3 ) call abort
33
end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.