gcc/testsuite/gfortran.dg/derived_external_function_1.f90
raw| 1 | ! { dg-do run } |
| 2 | ! |
| 3 | ! PR fortran/58771 |
| 4 | ! |
| 5 | ! Contributed by Vittorio Secca <[email protected]> |
| 6 | ! |
| 7 | ! ICEd on the write statement with f() because the derived type backend |
| 8 | ! declaration not built. |
| 9 | ! |
| 10 | module m |
| 11 | type t |
| 12 | integer(4) g |
| 13 | end type |
| 14 | end |
| 15 | |
| 16 | type(t) function f() result(ff) |
| 17 | use m |
| 18 | ff%g = 42 |
| 19 | end |
| 20 | |
| 21 | use m |
| 22 | character (20) :: line1, line2 |
| 23 | type(t) f |
| 24 | write (line1, *) f() |
| 25 | write (line2, *) 42_4 |
| 26 | if (line1 .ne. line2) STOP 1 |
| 27 | end |