Bug 36697 - SIGSEGV on program exit with gcc 4.3.1
Summary: SIGSEGV on program exit with gcc 4.3.1
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.3.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-02 15:33 UTC by Benny Ammitzbøll
Modified: 2009-12-11 18:15 UTC (History)
1 user (show)

See Also:
Host: i386-pc-linux-gnu
Target: arm-linux-uclibc
Build: i386-pc-linux-gnu
Known to work:
Known to fail: 4.3.1
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benny Ammitzbøll 2008-07-02 15:33:45 UTC
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 ();
       }
   }
Comment 1 Ramana Radhakrishnan 2009-04-29 14:38:28 UTC
The new code has a value of max_idx of DTOR_END - DTOR_LIST - 1. You might want to see why your implementation has a value of max_idx > 1. It doesn't appear to be a target bug yet - Please check this and get back with any more information with a compiler of more recent vintage.
Comment 2 Ramana Radhakrishnan 2009-12-11 18:15:36 UTC
No feedback in more than 6 months .