Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 8720
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Mark Mitchell <mmitchel@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: pmladek@suse.cz
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
a.ii a.ii text/x-c++ 2003-05-21 15:16 107 bytes Edit
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 8720 depends on: Show dependency tree
Show dependency graph
Bug 8720 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2002-11-26 09:46
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&#283;ný p&#345;ístup do pam&#283;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

------- Comment #1 From pmladek@suse.cz 2002-11-26 09:46 -------
Fix:
http://gcc.gnu.org/ml/gcc-patches/2002-12/msg00163.html

------- Comment #2 From Wolfgang Bangerth 2002-11-26 10:01 -------
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. It is a mainline regression.

------- Comment #3 From Mark Mitchell 2002-12-02 11:44 -------
Responsible-Changed-From-To: unassigned->mmitchel
Responsible-Changed-Why: Working on a fix.

------- Comment #4 From Mark Mitchell 2002-12-02 22:57 -------
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in GCC 3.3.

------- Comment #5 From Mark Mitchell 2002-12-03 06:52 -------
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
 


------- Comment #6 From Mark Mitchell 2002-12-03 06:52 -------
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
 

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug