[Bug fortran/54874] [OOP] polymorphic allocation with SOURCE

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 9 19:42:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54874

--- Comment #11 from janus at gcc dot gnu.org 2012-10-09 19:41:41 UTC ---
(In reply to comment #10)
> Ok, I just tried this one on x86_64-apple-darwin11.3.0, where I have three
> (non-release) versions of gfortran lying around:
> 
> gcc-Version 4.6.0 20110202 (experimental) [trunk revision 169590] (GCC)
> gcc-Version 4.7.0 20111231 (experimental) [trunk revision 182754] (GCC) 
> gcc-Version 4.8.0 20120409 (experimental) [trunk revision 186243] (GCC)

To expand on that, the 4.6 version at runtime produces the following on comment
0 and comment 1:

a.out(356) malloc: *** error for object 0x7ffc8ac01840: pointer being freed was
not allocated
*** set a breakpoint in malloc_error_break to debug

... which is apparently the same problem that Salvatore reported.


Compiling comment 0 with the 4.7 version produces the following at runtime:

 level            1
 New inner descr

 level            1
 New inner descr
 level            2
 New inner descr
a.out(399) malloc: *** error for object 0x7f8340401840: pointer being freed was
not allocated
*** set a breakpoint in malloc_error_break to debug

Backtrace for this error:
0   libgfortran.3.dylib                 0x00000001019c0d97
_gfortrani_show_backtrace + 55
1   ???                                 0x00007fff615f2da0 0x0 +
140734827015584
2   libsystem_c.dylib                   0x00007fff94b8d84c free + 389
3   a.out                               0x00000001019b7fec
__testmod_MOD___copy_testmod_Outer + 94
4   a.out                               0x00000001019b86c9 MAIN__ + 1703
5   a.out                               0x00000001019b8b6e main + 54
6   a.out                               0x00000001019b7e94 start + 52


4.8 does not show any runtime errors with comment 0 or comment 1 (except for
the 'wrong' output for comment 0).



More information about the Gcc-bugs mailing list