Bug with egcs-19990428 on i586-pc-linux-gnulibc1 ?
Andrew Pollard
andrew@odie.demon.co.uk
Thu Apr 29 07:22:00 GMT 1999
Hi All,
[ System: Linux-2.0.36-SMP, libc-5.4.46, binutils-2.9.1.0.22b
egcs : egcs-19990428 snapshot, configured with
% ./configure --prefix=/usr --with-gnu-as --with-gnu-ld --enable-version-specific-runtime-libs --enable-shared
and 3 stage compiled with
% make CFLAGS='-O2' LIBCFLAGS='-g -O2' LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap
]
With the following pieces of code (which were whittled down from some
source code at work...)
A.h:
------------------------------------------------------------------------
struct A {
A(int=0, int=0);
};
#define B() static A _A(0)
------------------------------------------------------------------------
A.cxx:
------------------------------------------------------------------------
#include "A.h"
B();
A::A(int, int) {}
------------------------------------------------------------------------
main.cxx:
------------------------------------------------------------------------
#include "A.h"
B();
int main() { return(0); }
------------------------------------------------------------------------
% g++ -v
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.93.20/specs
gcc version egcs-2.93.20 19990427 (gcc2 ss-980929 experimental)
% g++ main.cxx A.cxx
% a.out
% g++ -O main.cxx A.cxx
% a.out
Segmentation fault
% g++ -O -g main.cxx A.cxx
% gdb a.out
GNU gdb 4.17.0.11 with Linux support
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i586-pc-linux"...
(gdb) run
starting program: /home/andrew/bugs/track/a.out
Program received signal SIGSEGV, Segmentation fault.
0x80485d4 in __do_global_ctors_aux ()
(gdb) where
#0 0x80485d4 in __do_global_ctors_aux ()
(gdb)
By changing A.h to be (ie removing the '0' from the _A(0))
A.h:
------------------------------------------------------------------------
struct A {
A(int=0, int=0);
};
#define B() static A _A()
------------------------------------------------------------------------
It works fine.
It also works with gcc2722, egcs103 and egcs112.
It also fails with the CVS tree of late Apr28 (UK time).
Am I doing something silly? Or is this actually a problem with egcs?
I hope there is enough information here, if not, please contact me.
Cheers,
Andrew.
--
Andrew Pollard, Auto Simulations Ltd. UK. | home: andrew@odie.demon.co.uk
2 Milbanke Court, Milbanke Way, Bracknell | work: Andrew_Pollard@autosim.com
Tel/Fax: (+44(0)1344) 426486x103 / 426615 | http://www.odie.demon.co.uk
More information about the Gcc-bugs
mailing list