OSDN Git Service

2007-10-31 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / module_read_1.f90
1 ! { dg-do run }
2 ! PR fortran/33941
3 ! The problem was that the intrinsic operators
4 ! were written to the module file as '/=' etc.
5 ! but this format was not understood on reading.
6 !
7 ! Test case by Toby White, stripped down by
8 ! Dominique d'Humieres and Francois-Xavier Coudert
9
10 module foo
11 contains
12   function pop(n) result(item)
13     integer :: n
14     character(len=merge(1, 0, n > 0)) :: item
15   end function pop
16   function push(n) result(item)
17     integer :: n
18     character(len=merge(1, 0, n /= 0)) :: item
19   end function push
20 end module foo
21
22 program test
23   use foo
24   if(len(pop(0)) /= 0) call abort()
25   if(len(pop(1)) /= 1) call abort()
26   if(len(push(0)) /= 0) call abort()
27   if(len(push(1)) /= 1) call abort()
28 end program
29 ! { dg-final { cleanup-modules "foo" } }