[Bug c++/33937] New: static variables destruction results in a segmentation fault (Coredumps)

2007-10-29 Thread ssharma at thegoldensource dot com
My application crashes when shutting down on RH4.  We did a lot of
investigation and found that the crash occurs when the system tries to destruct
static variables.  

Our OS is Red Hat Enterprise Linux AS release 4 (Nahant Update 5).  I am using
the following compiler - gcc version 3.4.6 20060404 (Red Hat 3.4.6-8).

Ours is a complex application using a lot of shared libraries.  Below is the
explanation of the problem.

We have a shared library libXYZ.so which uses static variables as well as
classes containing static members. 
Our program loads this library libXYZ.so using dlopen function. 
The program runs fine. 
But on shut down, it crashes at the point where it tries to destruct the static
variables.  The library has been unloaded long back. 
All the static variables have been cleaned properly from within the application 
If we change the static variables to non-static, the crash does not occur. 
The crash does not occur on SUN SOLARIS platform 


I would like to know:

Have you heard of any such problem with static variables on shutdown on linux
with gcc? 
Why would such a crash occur only on linux and not on Solaris? 
Older gcc versions had this problem, but ours is quite new.  Is there any patch
that needs to be applied on Linux. 

A very similar problem has already been reported to gcc -
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27319



Any input on this will be helpful.


-- 
   Summary: static variables destruction results in a segmentation
fault (Coredumps)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ssharma at thegoldensource dot com


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



[Bug c++/33937] static variables destruction results in a segmentation fault (Coredumps)

2007-10-29 Thread ssharma at thegoldensource dot com


-- 

ssharma at thegoldensource dot com changed:

   What|Removed |Added

   Severity|normal  |critical


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



[Bug c++/33937] static variables destruction results in a segmentation fault (Coredumps)

2007-12-02 Thread ssharma at thegoldensource dot com


--- Comment #2 from ssharma at thegoldensource dot com  2007-12-03 05:09 
---
Providing a test case would be difficult since the code is huge cannot be
emailed, however the problem got resolved only when we removed all static
global variables and replaced them by either local variables or member
variables or just removed the static keyword.

But we are still not sure why the Linux gcc is not destroying the objects when
the application is shut down. The same conversion is working on the Solaris
environment without any problems.


-- 


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