This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/36697] New: SIGSEGV on program exit with gcc 4.3.1


I get SIGSEGV when my C and C++ programs exits. I have tracked it down to the
__do_global_dtors_aux function. The newly added code under HIDDEN_DTOR_LIST_END
does not check if the function ptr from the list is 0 - which the old code
below does. On my platform (no-mmu ARM, uclibc, uclinux) at least there are
zero-pointers in that __DTOR_LIST__.

This patch solved the issue for me:

--- gcc-4.3.1.org/gcc/crtstuff.c        2008-07-02 15:52:23.000000000 +0200
+++ gcc-4.3.1/gcc/crtstuff.c    2008-07-02 17:03:35.000000000 +0200
@@ -298,6 +298,7 @@
     while (dtor_idx < max_idx)
       {
        f = __DTOR_LIST__[++dtor_idx];
+       if (!f) break;
        f ();
       }
   }


-- 
           Summary: SIGSEGV on program exit with gcc 4.3.1
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: benny at ammitzboell-consult dot dk
 GCC build triplet: i386-pc-linux-gnu
  GCC host triplet: i386-pc-linux-gnu
GCC target triplet: arm-linux-uclibc


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]