------- Comment #2 from dominiq at lps dot ens dot fr 2009-04-24 08:54 ------- Confirmed for gfortran 4.3.3, 4.4.0, and trunk; no error with 4.2.3.
g95 0.91 gives: Setting bunch_params 113 113 Have set After 1st set Setting bunch_params 113 113 Have set End Remaining memory: 10848 bytes at 00800218 allocated at line 95 of pr39879.f90 Remaining memory: 60 bytes at 00100418 allocated at line 92 of pr39879.f90 Remaining memory: 224 bytes at 00100318 allocated at line 89 of pr39879.f90 Remaining memory: 60 bytes at 00100478 allocated at line 92 of pr39879.f90 Remaining memory: 10848 bytes at 00802e18 allocated at line 96 of pr39879.f90 and g95 0.92 (Apr 22 2009) ... End Remaining memory: 68 bytes at 001003b8 allocated at line 92 of pr39879.f90 Remaining memory: 228 bytes at 001002b8 allocated at line 89 of pr39879.f90 Remaining memory: 68 bytes at 00100418 allocated at line 92 of pr39879.f90 Remaining memory: 10848 bytes at 00802e18 allocated at line 96 of pr39879.f90 Adding the lines deallocate (u%model%bunch_params) deallocate (u%design%bunch_params) deallocate (u%design, u%model) deallocate (s%u) make g95 0.91 happy, g95 0.92 gives ... End At line 102 of file pr39879_db.f90 Traceback: not available, compile with -ftrace=frame or -ftrace=full Fortran runtime error: Deallocated a bad pointer gfortran 4.2.3 is also happy, while the other versions give ... Have set a.out(67213) malloc: *** error for object 0x809200: double free *** set a breakpoint in malloc_error_break to debug End a.out(67213) malloc: *** error for object 0x809200: double free *** set a breakpoint in malloc_error_break to debug -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39879