The following program uses an excessive amount of memory, which causes the segmentation fault. valgrind shows: ==27188== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==27188== Access not within mapped region at address 0x7FE001700 ==27188== at 0x427539: gfc_compare_derived_types (interface.c:365) ==27188== Invalid write of size 8 ==27188== at 0x4A1E348: _vgnU_freeres (in /usr/lib64/valgrind/amd64-linux/vgpreload_core.so) ==27188== Address 0x7fe001f70 is on thread 1's stack ==27188== Stack overflow in thread 1: can't grow stack to 0x7FE001F70 ! Regression. ICE on valid code. ! The following works with 4.1.3 and 4.2.2, but fails ! (segmentation fault) with 4.3.0. ! ! Found using the Fortran Company Fortran 90 Test Suite (Lite), ! Version 1.4 program error implicit none type node sequence type(node), pointer :: next end type type(node), pointer :: list interface subroutine insert(ptr) implicit none type node sequence type(node), pointer :: next end type type(node), pointer :: ptr end subroutine insert end interface allocate (list); end program error
This is probably related to PR22571?!
Confirmed, we run out of stack: $ gdb ~/libexec/gcc/i686-pc-linux-gnu/4.3.0/f951 GNU gdb 6.6.90.20070912-debian Copyright (C) 2007 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu"... Using host libthread_db library "/lib/i686/cmov/libthread_db.so.1". (gdb) r error.f90 Starting program: /home/ig25/libexec/gcc/i686-pc-linux-gnu/4.3.0/f951 error.f90 error Program received signal SIGSEGV, Segmentation fault. 0x0806d94a in gfc_compare_derived_types (derived1=0x89b3e38, derived2=0x89b4888) at ../../../gcc/trunk/gcc/fortran/interface.c:365 365 if (derived1 != NULL && derived2 != NULL (gdb) bt full #0 0x0806d94a in gfc_compare_derived_types (derived1=0x89b3e38, derived2=0x89b4888) at ../../../gcc/trunk/gcc/fortran/interface.c:365 dt1 = <value optimized out> dt2 = <value optimized out> #1 0x0806da2c in gfc_compare_derived_types (derived1=0x89b3e38, derived2=0x89b4888) at ../../../gcc/trunk/gcc/fortran/interface.c:410 dt1 = (gfc_component *) 0x8992260 dt2 = (gfc_component *) 0x89b49d0 #2 0x0806da2c in gfc_compare_derived_types (derived1=0x89b3e38, derived2=0x89b4888) at ../../../gcc/trunk/gcc/fortran/interface.c:410 dt1 = (gfc_component *) 0x8992260 dt2 = (gfc_component *) 0x89b49d0 #3 0x0806da2c in gfc_compare_derived_types (derived1=0x89b3e38, derived2=0x89b4888) at ../../../gcc/trunk/gcc/fortran/interface.c:410 dt1 = (gfc_component *) 0x8992260 dt2 = (gfc_component *) 0x89b49d0 #4 0x0806da2c in gfc_compare_derived_types (derived1=0x89b3e38, derived2=0x89b4888) at ../../../gcc/trunk/gcc/fortran/interface.c:410 dt1 = (gfc_component *) 0x8992260 dt2 = (gfc_component *) 0x89b49d0 #5 0x0806da2c in gfc_compare_derived_types (derived1=0x89b3e38, derived2=0x89b4888) at ../../../gcc/trunk/gcc/fortran/interface.c:410 dt1 = (gfc_component *) 0x8992260 dt2 = (gfc_component *) 0x89b49d0 #6 0x0806da2c in gfc_compare_derived_types (derived1=0x89b3e38, derived2=0x89b4888) at ../../../gcc/trunk/gcc/fortran/interface.c:410 dt1 = (gfc_component *) 0x8992260 dt2 = (gfc_component *) 0x89b49d0 #7 0x0806da2c in gfc_compare_derived_types (derived1=0x89b3e38, derived2=0x89b4888) at ../../../gcc/trunk/gcc/fortran/interface.c:410 dt1 = (gfc_component *) 0x8992260 dt2 = (gfc_component *) 0x89b49d0 #8 0x0806da2c in gfc_compare_derived_types (derived1=0x89b3e38, derived2=0x89b4888) at ../../../gcc/trunk/gcc/fortran/interface.c:410 dt1 = (gfc_component *) 0x8992260 dt2 = (gfc_component *) 0x89b49d0 #9 0x0806da2c in gfc_compare_derived_types (derived1=0x89b3e38, derived2=0x89b4888) at ../../../gcc/trunk/gcc/fortran/interface.c:410 dt1 = (gfc_component *) 0x8992260 dt2 = (gfc_component *) 0x89b49d0 #10 0x0806da2c in gfc_compare_derived_types (derived1=0x89b3e38, derived2=0x89b4888)
Subject: Bug 34558 Author: pault Date: Mon Dec 31 18:05:10 2007 New Revision: 131238 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131238 Log: 2007-12-31 Paul Thomas <pault@gcc.gnu.org> PR fortran/34558 * interface.c (gfc_compare_types): Prevent linked lists from putting this function into an endless recursive loop. 2007-12-31 Paul Thomas <pault@gcc.gnu.org> PR fortran/34558 * gfortran.dg/linked_list_1.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/linked_list_1.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/interface.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 34558 Author: pault Date: Mon Dec 31 18:10:55 2007 New Revision: 131239 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131239 Log: 2007-12-31 Paul Thomas <pault@gcc.gnu.org> PR fortran/34558 * interface.c (gfc_compare_types): Prevent linked lists from putting this function into an endless recursive loop. 2007-12-31 Paul Thomas <pault@gcc.gnu.org> PR fortran/34558 * gfortran.dg/linked_list_1.f90: New test. Modified: trunk/gcc/fortran/interface.c
Fixed as obvious - sorry about the double commit; I had a bit of finger trouble with my editor and reverted to a previous, incorrect version of the patch. Paul