The executable of the following code: external fun real fun real a a = fun() print *, a print *, fun() end real function fun() print *, 'test' fun = 1.0 end
compiled with 4.3.0 20070126, hangs. -fdump-tree-original gives: MAIN__ () { real4 a; _gfortran_set_std (70, 127, 0, 0); a = fun (); { struct __st_parameter_dt dt_parm.0; dt_parm.0.common.filename = "fun_external.f90"; dt_parm.0.common.line = 5; dt_parm.0.common.unit = 6; dt_parm.0.common.flags = 128; _gfortran_st_write (&dt_parm.0); _gfortran_transfer_real (&dt_parm.0, &a, 4); _gfortran_st_write_done (&dt_parm.0); } { struct __st_parameter_dt dt_parm.1; dt_parm.1.common.filename = "fun_external.f90"; dt_parm.1.common.line = 6; dt_parm.1.common.unit = 6; dt_parm.1.common.flags = 128; _gfortran_st_write (&dt_parm.1); { real4 D.951; D.951 = fun (); _gfortran_transfer_real (&dt_parm.1, &D.951, 4); } _gfortran_st_write_done (&dt_parm.1); } } fun () { real4 __result_fun; { struct __st_parameter_dt dt_parm.2; dt_parm.2.common.filename = "fun_external.f90"; dt_parm.2.common.line = 9; dt_parm.2.common.unit = 6; dt_parm.2.common.flags = 128; _gfortran_st_write (&dt_parm.2); _gfortran_transfer_character (&dt_parm.2, "test", 4); _gfortran_st_write_done (&dt_parm.2); } __result_fun = 1.0e+0; return __result_fun; } and if run under gdb, after ^C, where gives: #0 0x90017238 in semaphore_wait_signal_trap () #1 0x90001d90 in pthread_mutex_lock () #2 0x0020093c in get_external_unit (n=6, do_create=3331) at ../../../gcc-4.3-20070127/libgfortran/../gcc/gthr-posix.h:604 #3 0x001ff6e0 in data_transfer_init (dtp=0x6004d8, read_flag=3331) at ../../../gcc-4.3-20070127/libgfortran/io/transfer.c:1698 #4 0x00002b48 in fun_ () at fun_external.f90:9 #5 0x00002abc in MAIN__ () at fun_external.f90:6 #6 0x00002bac in main (argc=14, argv=0xd03) at ../../../gcc-4.3-20070127/libgfortran/fmain.c:18 Note that I see the same problem on OSX 10.4 with gcc version 4.2.0 20060617. Any idea around? -- Summary: recursive I/O hangs under OSX 10.3 Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dominiq at lps dot ens dot fr GCC target triplet: powerpc-apple-darwin7 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30617