URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [ret_array_1.f90] - Rev 823
Go to most recent revision | Compare with Previous | Blame | View Log
! { dg-do run }! Test functions returning arrays of indeterminate size.program ret_array_1integer, dimension(:, :), allocatable :: ainteger, dimension(2) :: ballocate (a(2, 3))a = reshape ((/1, 2, 3, 4, 5, 6/), (/2, 3/))! Using the return value as an actual argumentb = 0;b = sum (transpose (a), 1);if (any (b .ne. (/9, 12/))) call abort ()! Using the return value in an expressionb = 0;b = sum (transpose (a) + 1, 1);if (any (b .ne. (/12, 15/))) call abort ()! Same again testing a user function! TODO: enable these once this is implemented! b = 0;! b = sum (my_transpose (a), 1);! if (any (b .ne. (/9, 12/))) call abort ()!! ! Using the return value in an expression! b = 0;! b = sum (my_transpose (a) + 1, 1);! if (any (b .ne. (/12, 15/))) call abort ()containssubroutine test(x, n)integer, dimension (:, :) :: xinteger nif (any (shape (x) .ne. (/3, 2/))) call abortif (any (x .ne. (n + reshape((/1, 4, 2, 5, 3, 6/), (/3, 2/))))) call abortend subroutinefunction my_transpose (x) result (r)interfacepure function obfuscate (i)integer obfuscateinteger, intent(in) :: iend functionend interfaceinteger, dimension (:, :) :: xinteger, dimension (obfuscate(ubound(x, 2)), &obfuscate(ubound(x, 1))) :: rinteger ido i = 1, ubound(x, 1)r(:, i) = x(i, :)end doend functionend programpure function obfuscate (i)integer obfuscateinteger, intent(in) :: iobfuscate = iend function
Go to most recent revision | Compare with Previous | Blame | View Log
