[Bug fortran/86576] [F03][OOP] Sourced allocation of object array fails with SEGFAULT

dominiq at lps dot ens.fr gcc-bugzilla@gcc.gnu.org
Fri Jul 27 11:05:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86576

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-07-27
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I have had a hard time to reproduce the segfault:

% gfc pr86576.f90 -fno-backtrace
% ./a.out
Segmentation fault
% ./a.out
% ./a.out
Segmentation fault
% ./a.out
Segmentation fault
% ./a.out
% ./a.out
Segmentation fault
% ./a.out
% ./a.out
Segmentation fault
% ./a.out
% ./a.out
Segmentation fault

The situation is a little simpler if I compile the test with -m32

% gfc pr86576.f90 -fno-backtrace -m32
% ./a.out
Segmentation fault
% ./a.out
Segmentation fault
% ./a.out
Segmentation fault
% ./a.out
Segmentation fault
% ./a.out
Segmentation fault
% ./a.out
Segmentation fault
% ./a.out
Segmentation fault

Valgrind complains

==448== Memcheck, a memory error detector
==448== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==448== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==448== Command: a.out
==448== 
==448== Invalid read of size 8
==448==    at 0x10000285B: MAIN__ (pr86576.f90:100)
==448==    by 0x100002AD1: main (pr86576.f90:87)
==448==  Address 0x1004ce468 is not stack'd, malloc'd or (recently) free'd
==448== 
==448== Invalid read of size 8
==448==    at 0x100002874: MAIN__ (pr86576.f90:100)
==448==    by 0x100002AD1: main (pr86576.f90:87)
==448==  Address 0x1004ce460 is not stack'd, malloc'd or (recently) free'd
==448== 
==448== Invalid read of size 8
==448==    at 0x1000028E0: MAIN__ (pr86576.f90:100)
==448==    by 0x100002AD1: main (pr86576.f90:87)
==448==  Address 0x1004ce498 is 0 bytes after a block of size 8 alloc'd
==448==    at 0x100014679: malloc (vg_replace_malloc.c:266)
==448==    by 0x1000012C3: __build_MOD___copy_build_Otype (pr86576.f90:82)
==448==    by 0x100001B8C: __build_MOD_get_result (pr86576.f90:79)
==448==    by 0x1000024B1: MAIN__ (pr86576.f90:100)
==448==    by 0x100002AD1: main (pr86576.f90:87)
==448== 
==448== Invalid read of size 8
==448==    at 0x1000028E3: MAIN__ (pr86576.f90:100)
==448==    by 0x100002AD1: main (pr86576.f90:87)
==448==  Address 0x28 is not stack'd, malloc'd or (recently) free'd
==448== 
==448== 
==448== Process terminating with default action of signal 11 (SIGSEGV)
==448==  General Protection Fault
==448==    at 0x1002FEFC1: dyld_stub_binder (in /usr/lib/libSystem.B.dylib)
==448==    by 0x10018D03F: ??? (in /opt/gcc/gcc9w/lib/libgfortran.5.dylib)
==448==    by 0x100002AD1: main (pr86576.f90:87)
==448== 
==448== HEAP SUMMARY:
==448==     in use at exit: 7,260 bytes in 29 blocks
==448==   total heap usage: 35 allocs, 6 frees, 7,340 bytes allocated
==448== 
==448== LEAK SUMMARY:
==448==    definitely lost: 0 bytes in 0 blocks
==448==    indirectly lost: 0 bytes in 0 blocks
==448==      possibly lost: 0 bytes in 0 blocks
==448==    still reachable: 7,172 bytes in 28 blocks
==448==         suppressed: 88 bytes in 1 blocks
==448== Rerun with --leak-check=full to see details of leaked memory
==448== 
==448== For counts of detected and suppressed errors, rerun with: -v
==448== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
Segmentation fault


More information about the Gcc-bugs mailing list