This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
I got an internal compiler error by compilation of the OpenOffice.org. I created a simple example with the same behaviour: class A { public: A(int nBits = ((int)0x8) | ((int)0x4) | ((int)0x2)); }; Some observations when the segfault does not occur: - when 2 or 4 operands are used in bitwise operator A(int nBits = ((int)0x8) | ((int)0x4) ); or A(int nBits = ((int)0x8) | ((int)0x4) | ((int)0x2) | ((int)0x1) ); - when the braces around the casts are removed: A(int nBits = (int)0x8 | (int)0x4 | (int)0x2 ); - when the casts are removed A(int nBits = (0x8) | (0x4) | (0x2)); - when the whole expression is given into braces A(int nBits = (((int)0x8) | ((int)0x4) | ((int)0x2)) ); OpenOffice.org uses this problematic pattern because the constants are defined by #define and the cast is not to (int) but to the (WinBits). The complete error message is: g++ -v -save-temps -c a.cxx Reading specs from /usr/lib/gcc-lib/i486-suse-linux/3.3/specs Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local- prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/us r/lib --enable-languages=c,c++,f77,objc,java,ada --disable-checking --enable-lib gcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zl ib --enable-shared --enable-__cxa_atexit i486-suse-linux Thread model: posix gcc version 3.3 20021111 (experimental) (SuSE Linux) /usr/lib/gcc-lib/i486-suse-linux/3.3/cc1plus -E -D__GNUG__=3 -quiet -v -D__GNUC __=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D_GNU_SOURCE a.cxx a.ii #include "..." search starts here: #include <...> search starts here: /usr/include/g++ /usr/include/g++/i486-suse-linux /usr/include/g++/backward /usr/local/include /usr/lib/gcc-lib/i486-suse-linux/3.3/include /usr/i486-suse-linux/include /usr/include End of search list. /usr/lib/gcc-lib/i486-suse-linux/3.3/cc1plus -fpreprocessed a.ii -quiet -dumpba se a.cxx -auxbase a -version -o a.s GNU C++ version 3.3 20021111 (experimental) (SuSE Linux) (i486-suse-linux) compiled by GNU C version 3.3 20021111 (experimental) (SuSE Linux). a.cxx:4: internal compiler error: Neoprávněný přístup do paměti (SIGSEGV) Release: gcc version 3.3 20021111 (experimental) (SuSE Linux) Environment: SuSE linux, beta-i386 glibc-2.3.1 How-To-Repeat: g++ -c a.ii
Fix: http://gcc.gnu.org/ml/gcc-patches/2002-12/msg00163.html
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed. It is a mainline regression.
Responsible-Changed-From-To: unassigned->mmitchel Responsible-Changed-Why: Working on a fix.
State-Changed-From-To: analyzed->closed State-Changed-Why: Fixed in GCC 3.3.
From: mmitchel@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: c++/8720 Date: 3 Dec 2002 06:52:26 -0000 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2002-12-02 22:52:25 Modified files: gcc/cp : ChangeLog error.c spew.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/parse: defarg1.C gcc/testsuite/g++.dg/template: char1.C Log message: PR c++/8720 * spew.c (remove_last_token): Make sure that last_chunk is set correctly. PR c++/8615 * error.c (dump_expr): Handle character constants with TREE_OVERFLOW set. PR c++/8720 * g++.dg/parse/defarg1.C: New test. PR c++/8615 * g++.dg/template/char1.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3064&r2=1.3065 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&r1=1.189&r2=1.190 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/spew.c.diff?cvsroot=gcc&r1=1.75&r2=1.76 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2248&r2=1.2249 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/defarg1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/char1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1