This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
egcs simple multithreaded program bug on AIX 4.3
- To: gcc-bugs at gcc dot gnu dot org
- Subject: egcs simple multithreaded program bug on AIX 4.3
- From: Ashley Herring <Ashley dot herring at str dot com dot au>
- Date: Mon, 16 Aug 1999 15:04:21 +1000
Compiler: egcs, version 2.91.60
Environment: IBM RS6000, AIX 4.3.2.0, Dual CPU, 256 Meg RAM.
Problem:
The file simple.cpp starts up 6 posix threads (this problem
occurs intermittently for 2 threads, but on our system 6 threads tended
to crash almost every time). Each thread runs the same code, a void*
Run(void*) routine, however, no data is shared between threads. It
involves instantiating a simple class CMyTimezone, which in turn has an
instance of another simple class MyTime in it (these names are the
result of simplifying one of our applications down to this program)
The code will only crash on a non-optimised build, or an
optimised build with function inlining disabled, so actual function
calls are used for the constructor / destructor of the simple classes
CMyTimezone and MyTime. It only crashes if the Run routine instantiates
CMyTimezone, not MyTime. It seems that:
Run
- instantiates CMyTimezone
- instantiates MyTime
regularly crashes the program with a SIGSEV.
example output:
%./simple
size of CMyTime is 24
start
start
start
start
start
start
zsh: segmentation fault (core dumped) ./simple
The char[24] member data in MyTime was used to vary the size of the
class to see what effect that had.
We installed xlC on the AIX box to compile this simple.cpp program, and
it ran it fine.
this tar.gz file contains simple.cpp, simple.ii & simple.s
<<simple.tar.gz>>
We are in the process of creating a cross-platform multi-threaded server
application for NT,Solaris, IRIX & AIX. We have used egcs to
successfully port it to Solaris and would like to use the same
development tools (ie egcs) for all unix platforms. So far we have
managed to get the program compiling, linking & working fine on AIX, but
it regularly blows up when more than one thread is working at once, even
if those threads share NO commond code or data. Weeks of debugging
produced the simple.cpp file which, from our perspective, indicated that
there was some inherent fault in the code being generate by egcs. We
have also tried various different gcc code generation options to no
avail.
Any help in getting around this problem would be much appreciated,
thanks in advance,
Ashley Herring
Software Engineer
Space-Time Research Pty Ltd
E-mail ashley.herring@str.com.au
Tel +61 3 9805 3415
simple.tar.gz