https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82996
Dominique d'Humieres <dominiq at lps dot ens.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |37336 --- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- > I think Dominique swapped 2 and 3. Indeed! If I compile the tests in comment 0 or 1 with '-fsanitize=address,undefined', I get at run time an error of the kind: pr82996.f90:17: runtime error: member access within misaligned address 0x1000e3e7620c for type 'struct foo', which requires 8 byte alignment 0x1000e47d2bec: note: pointer points here ASAN:DEADLYSIGNAL ================================================================= ==3427==ERROR: AddressSanitizer: SEGV on unknown address 0x12001c8fa57d (pc 0x00010796507b bp 0x7ffee84cd9c0 sp 0x7ffee84cd150 T0) #0 0x10796507a in wrap_write.part.20 (/opt/gcc/gcc7wr/lib/libasan.4.dylib+0x2507a) #1 0x109224d2e in __sanitizer::IsAccessibleMemoryRange(unsigned long, unsigned long) (/opt/gcc/gcc7wr/lib/libubsan.0.dylib+0x17d2e) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV (/opt/gcc/gcc7wr/lib/libasan.4.dylib+0x2507a) in wrap_write.part.20 ==3427==ABORTING Program received signal SIGABRT: Process abort signal. If I remove 'elemental' for 'subroutine foo_destroy', the segfault is gone. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336 [Bug 37336] [F03] Finish derived-type finalization