public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20008] New: internal compiler error: in expand_case, at stmt.c:2397
@ 2005-02-16 19:46 caolanm at redhat dot com
2005-02-16 19:47 ` [Bug c++/20008] " caolanm at redhat dot com
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: caolanm at redhat dot com @ 2005-02-16 19:46 UTC (permalink / raw)
To: gcc-bugs
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --with-gxx-include-dir=/usr/include/c++/3.4.3
--enable-languages=c,c++,java,f95 --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 4.0.0 20050216 (Red Hat 4.0.0-0.24)
---
/usr/src/redhat/BUILD/SRC680_m77/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx:756:
internal compiler error: in expand_case, at stmt.c:2397
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Preprocessed source stored into /tmp/cck1QjtG.out file, please attach this to
your bugreport.
---
g++4 -Wreturn-type -fmessage-length=0 -c -I. -I. -I../inc -I../../../inc
-I../../../unx/inc -I../../../unxlngi6.pro/inc -I.
-I/usr/src/redhat/BUILD/SRC680_m77/solver/680/unxlngi6.pro/inc/stl
-I/usr/src/redhat/BUILD/SRC680_m77/solver/680/unxlngi6.pro/inc/external
-I/usr/src/redhat/BUILD/SRC680_m77/solver/680/unxlngi6.pro/inc
-I/usr/src/redhat/BUILD/SRC680_m77/solenv/unxlngi6/inc
-I/usr/src/redhat/BUILD/SRC680_m77/solenv/inc
-I/usr/src/redhat/BUILD/SRC680_m77/res
-I/usr/src/redhat/BUILD/SRC680_m77/solver/680/unxlngi6.pro/inc/stl
-I/usr/src/redhat/BUILD/SRC680_m77/solenv/inc/Xp31 -I/usr/include
-I/usr/X11R6/include -I/usr/include/mozilla-1.7.5
-I/usr/include/mozilla-1.7.5/nspr -I../../../source/xmlsec -DSYSTEM_MOZILLA
-I/usr/include/mozilla-1.7.5/nss -I/usr/include/mozilla-1.7.5/nspr -I.
-I../../../res -I/usr/include/mozilla-1.7.5/profile
-I/usr/include/mozilla-1.7.5/string -I/usr/include/mozilla-1.7.5/embed_base
-Wuninitialized -g1 -Os -fno-strict-aliasing -DSYSTEM_LIBXML
-I/usr/include/libxml2 -fPIC -g -pipe -mtune=pentiumpro -Wno-ctor-dtor-privacy
-fexceptions -fno-enforce-eh-specs -fno-rtti -Wall -Wconversion -Wpointer-arith
-Wbad-function-cast -Wcast-align -Woverloaded-virtual -Wsynth -Wno-long-long
-pthread -fpic -DLINUX -DUNX -DVCL -DGCC -DC341 -DINTEL
-DGXX_INCLUDE_PATH=/usr/include/c++/3.4.3 -DCVER=C341 -D_USE_NAMESPACE -DGLIBC=2
-DX86 -D_PTHREADS -D_REENTRANT -DNEW_SOLAR -D_USE_NAMESPACE=1
-DSTLPORT_VERSION=400 -DHAVE_GCC_VISIBILITY_FEATURE -D__DMAKE -DUNIX
-DCPPU_ENV=gcc3 -DSUPD=680 -DPRODUCT -DNDEBUG -DPRODUCT_FULL -DOSL_DEBUG_LEVEL=0
-DOPTIMIZE -DEXCEPTIONS_ON -DCUI -DSOLAR_JAVA -DSRC680 -DTRACING
-DXMLSEC_CRYPTO_NSS -DXMLSEC_NO_XSLT -DSHAREDLIB -D_DLL_ -DMULTITHREAD -o
../../../unxlngi6.pro/slo/securityenvironment_nssimpl.o
/usr/src/redhat/BUILD/SRC680_m77/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
--
Summary: internal compiler error: in expand_case, at stmt.c:2397
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: caolanm at redhat dot com
CC: gcc-bugs at gcc dot gnu dot org,jakub at gcc dot gnu dot
org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/20008] internal compiler error: in expand_case, at stmt.c:2397
2005-02-16 19:46 [Bug c++/20008] New: internal compiler error: in expand_case, at stmt.c:2397 caolanm at redhat dot com
@ 2005-02-16 19:47 ` caolanm at redhat dot com
2005-02-16 19:56 ` [Bug c++/20008] [4.0 Regression] " pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: caolanm at redhat dot com @ 2005-02-16 19:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From caolanm at redhat dot com 2005-02-16 16:23 -------
Created an attachment (id=8203)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8203&action=view)
bzip2 compressed preprocesser output
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/20008] [4.0 Regression] internal compiler error: in expand_case, at stmt.c:2397
2005-02-16 19:46 [Bug c++/20008] New: internal compiler error: in expand_case, at stmt.c:2397 caolanm at redhat dot com
2005-02-16 19:47 ` [Bug c++/20008] " caolanm at redhat dot com
@ 2005-02-16 19:56 ` pinskia at gcc dot gnu dot org
2005-02-16 22:03 ` [Bug middle-end/20008] " pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-16 19:56 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Summary|internal compiler error: in |[4.0 Regression] internal
|expand_case, at stmt.c:2397 |compiler error: in
| |expand_case, at stmt.c:2397
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/20008] [4.0 Regression] internal compiler error: in expand_case, at stmt.c:2397
2005-02-16 19:46 [Bug c++/20008] New: internal compiler error: in expand_case, at stmt.c:2397 caolanm at redhat dot com
2005-02-16 19:47 ` [Bug c++/20008] " caolanm at redhat dot com
2005-02-16 19:56 ` [Bug c++/20008] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2005-02-16 22:03 ` pinskia at gcc dot gnu dot org
2005-02-16 23:36 ` [Bug c++/20008] " pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-16 22:03 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |middle-end
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/20008] [4.0 Regression] internal compiler error: in expand_case, at stmt.c:2397
2005-02-16 19:46 [Bug c++/20008] New: internal compiler error: in expand_case, at stmt.c:2397 caolanm at redhat dot com
` (2 preceding siblings ...)
2005-02-16 22:03 ` [Bug middle-end/20008] " pinskia at gcc dot gnu dot org
@ 2005-02-16 23:36 ` pinskia at gcc dot gnu dot org
2005-02-17 15:47 ` caolanm at redhat dot com
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-16 23:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-16 19:16 -------
Reduced testcase:
typedef enum _SECStatus {
SECWouldBlock = -2,
SECFailure = -1,
SECSuccess = 0
} SECStatus;
typedef enum {
SEC_ERROR_BAD_SIGNATURE = (-0x2000) + 10
} SECErrorCodes;
void g(void);
void f(SECStatus status)
{
switch( status )
{
case SEC_ERROR_BAD_SIGNATURE :
g();
break ;
}
}
: Search converges between 2004-10-25-161001-trunk (#610) and 2004-10-26-161001-trunk
(#611).
This is undefined code (as SEC_ERROR_BAD_SIGNATURE is out of the range of SECStatus). Enums are
defined differently in C++ than C.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|middle-end |c++
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-02-16 19:16:58
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/20008] [4.0 Regression] internal compiler error: in expand_case, at stmt.c:2397
2005-02-16 19:46 [Bug c++/20008] New: internal compiler error: in expand_case, at stmt.c:2397 caolanm at redhat dot com
` (3 preceding siblings ...)
2005-02-16 23:36 ` [Bug c++/20008] " pinskia at gcc dot gnu dot org
@ 2005-02-17 15:47 ` caolanm at redhat dot com
2005-02-17 20:00 ` aoliva at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: caolanm at redhat dot com @ 2005-02-17 15:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From caolanm at redhat dot com 2005-02-17 10:00 -------
FWIW: openoffice.org 1.9.77 side patch to workaround at
http://people.redhat.com/caolanm/gcc4/xmlsecurity.gcc20008.gcc4.patch
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/20008] [4.0 Regression] internal compiler error: in expand_case, at stmt.c:2397
2005-02-16 19:46 [Bug c++/20008] New: internal compiler error: in expand_case, at stmt.c:2397 caolanm at redhat dot com
` (4 preceding siblings ...)
2005-02-17 15:47 ` caolanm at redhat dot com
@ 2005-02-17 20:00 ` aoliva at gcc dot gnu dot org
2005-02-17 20:27 ` aoliva at redhat dot com
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2005-02-17 20:00 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |aoliva at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2005-02-16 19:16:58 |2005-02-17 15:13:15
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/20008] [4.0 Regression] internal compiler error: in expand_case, at stmt.c:2397
2005-02-16 19:46 [Bug c++/20008] New: internal compiler error: in expand_case, at stmt.c:2397 caolanm at redhat dot com
` (5 preceding siblings ...)
2005-02-17 20:00 ` aoliva at gcc dot gnu dot org
@ 2005-02-17 20:27 ` aoliva at redhat dot com
2005-02-18 18:29 ` cvs-commit at gcc dot gnu dot org
2005-02-18 18:32 ` jakub at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: aoliva at redhat dot com @ 2005-02-17 20:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From aoliva at gcc dot gnu dot org 2005-02-17 16:17 -------
Subject: [PR c++/20008, middle-end] handle switch with all cases out-of-range
Sure enough, the testcase relied on undefined behavior, but that's no
reason for us to ICE at compile time. I suppose it might be nice to
get the tree cfg cleanup code to detect that it can discard cases that
are out of range, but I'm not all that familiar with the cfg cleanup
code, so I figured I'd try this first.
Ok to install if regression testing passes on x86_64-linux-gnu?
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
PR c++/20008
* stmt.c (expand_case): Don't assume cleanup_tree_cfg will remove
cases that are out-of-range for the index type.
Index: gcc/stmt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.412
diff -u -p -r1.412 stmt.c
--- gcc/stmt.c 13 Dec 2004 16:03:38 -0000 1.412
+++ gcc/stmt.c 17 Feb 2005 16:12:31 -0000
@@ -1,6 +1,7 @@
/* Expands front end tree to back end RTL for GCC
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GCC.
@@ -2393,8 +2394,14 @@ expand_case (tree exp)
BITMAP_XFREE (label_bitmap);
/* cleanup_tree_cfg removes all SWITCH_EXPR with a single
- destination, such as one with a default case only. */
- gcc_assert (count != 0);
+ destination, such as one with a default case only. However,
+ it doesn't remove cases that are out of range for the switch
+ type, so we may still get a zero here. */
+ if (count == 0)
+ {
+ emit_jump (default_label);
+ return;
+ }
/* Compute span of values. */
range = fold (build2 (MINUS_EXPR, index_type, maxval, minval));
Index: gcc/testsuite/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
PR c++/20008
* g++.dg/opt/switch3.C: New.
Index: gcc/testsuite/g++.dg/opt/switch3.C
===================================================================
RCS file: gcc/testsuite/g++.dg/opt/switch3.C
diff -N gcc/testsuite/g++.dg/opt/switch3.C
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gcc/testsuite/g++.dg/opt/switch3.C 17 Feb 2005 16:12:45 -0000
@@ -0,0 +1,30 @@
+// { dg-do compile }
+
+// PR c++/20008
+
+// We failed to compile this because CFG cleanup left the switch
+// statement intact, whereas expand_case expected at least one
+// in-range case to remain.
+
+typedef enum _SECStatus {
+ SECWouldBlock = -2,
+ SECFailure = -1,
+ SECSuccess = 0
+} SECStatus;
+
+typedef enum {
+ SEC_ERROR_BAD_SIGNATURE = (-0x2000) + 10
+} SECErrorCodes;
+
+void g(void);
+void f(SECStatus status)
+{
+ switch( status )
+ {
+ case SEC_ERROR_BAD_SIGNATURE :
+ // This case can be optimized away in C++ (but apparently not in
+ // C), because the enum type is defined with a narrow range.
+ g();
+ break ;
+ }
+}
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/20008] [4.0 Regression] internal compiler error: in expand_case, at stmt.c:2397
2005-02-16 19:46 [Bug c++/20008] New: internal compiler error: in expand_case, at stmt.c:2397 caolanm at redhat dot com
` (6 preceding siblings ...)
2005-02-17 20:27 ` aoliva at redhat dot com
@ 2005-02-18 18:29 ` cvs-commit at gcc dot gnu dot org
2005-02-18 18:32 ` jakub at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-02-18 18:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-02-18 12:21 -------
Subject: Bug 20008
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: aoliva@gcc.gnu.org 2005-02-18 12:20:50
Modified files:
gcc : ChangeLog stmt.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/opt: switch4.C
Log message:
gcc/ChangeLog:
PR c++/20008
* stmt.c (expand_case): Don't assume cleanup_tree_cfg will remove
cases that are out-of-range for the index type.
gcc/testsuite/ChangeLog:
PR c++/20008
* g++.dg/opt/switch4.C: New.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7522&r2=2.7523
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&r1=1.415&r2=1.416
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5046&r2=1.5047
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/switch4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/20008] [4.0 Regression] internal compiler error: in expand_case, at stmt.c:2397
2005-02-16 19:46 [Bug c++/20008] New: internal compiler error: in expand_case, at stmt.c:2397 caolanm at redhat dot com
` (7 preceding siblings ...)
2005-02-18 18:29 ` cvs-commit at gcc dot gnu dot org
@ 2005-02-18 18:32 ` jakub at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-02-18 18:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jakub at gcc dot gnu dot org 2005-02-18 12:26 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20008
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-02-18 12:27 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-16 19:46 [Bug c++/20008] New: internal compiler error: in expand_case, at stmt.c:2397 caolanm at redhat dot com
2005-02-16 19:47 ` [Bug c++/20008] " caolanm at redhat dot com
2005-02-16 19:56 ` [Bug c++/20008] [4.0 Regression] " pinskia at gcc dot gnu dot org
2005-02-16 22:03 ` [Bug middle-end/20008] " pinskia at gcc dot gnu dot org
2005-02-16 23:36 ` [Bug c++/20008] " pinskia at gcc dot gnu dot org
2005-02-17 15:47 ` caolanm at redhat dot com
2005-02-17 20:00 ` aoliva at gcc dot gnu dot org
2005-02-17 20:27 ` aoliva at redhat dot com
2005-02-18 18:29 ` cvs-commit at gcc dot gnu dot org
2005-02-18 18:32 ` jakub at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).