public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/14730] New: [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher
@ 2004-03-25 5:15 pinskia at gcc dot gnu dot org
2004-03-25 6:48 ` [Bug middle-end/14730] " pinskia at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-25 5:15 UTC (permalink / raw)
To: gcc-bugs
int t(char i)
{
switch (i)
{
case 1:
case 7:
case 10:
case 14:
case 9:
case 256:
return 0;
}
return 0;
}
--
Summary: [tree-ssa] ICE on a switch statement with a case which
is bigger than the type of switcher
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14730
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14730] [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher
2004-03-25 5:15 [Bug middle-end/14730] New: [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher pinskia at gcc dot gnu dot org
@ 2004-03-25 6:48 ` pinskia at gcc dot gnu dot org
2004-03-25 9:55 ` falk at debian dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-25 6:48 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |tree-ssa
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14730
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14730] [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher
2004-03-25 5:15 [Bug middle-end/14730] New: [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher pinskia at gcc dot gnu dot org
2004-03-25 6:48 ` [Bug middle-end/14730] " pinskia at gcc dot gnu dot org
@ 2004-03-25 9:55 ` falk at debian dot org
2004-03-29 23:58 ` bje at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: falk at debian dot org @ 2004-03-25 9:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From falk at debian dot org 2004-03-25 09:55 -------
Confirmed. Here's the ICE:
test.c:3: internal compiler error: in tree_low_cst, at tree.c:3452
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14730
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14730] [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher
2004-03-25 5:15 [Bug middle-end/14730] New: [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher pinskia at gcc dot gnu dot org
2004-03-25 6:48 ` [Bug middle-end/14730] " pinskia at gcc dot gnu dot org
2004-03-25 9:55 ` falk at debian dot org
@ 2004-03-29 23:58 ` bje at gcc dot gnu dot org
2004-04-01 5:03 ` bje at au1 dot ibm dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: bje at gcc dot gnu dot org @ 2004-03-29 23:58 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |bje at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14730
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14730] [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher
2004-03-25 5:15 [Bug middle-end/14730] New: [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-03-29 23:58 ` bje at gcc dot gnu dot org
@ 2004-04-01 5:03 ` bje at au1 dot ibm dot com
2004-04-01 7:18 ` bje at au1 dot ibm dot com
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: bje at au1 dot ibm dot com @ 2004-04-01 5:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bje at au1 dot ibm dot com 2004-04-01 05:02 -------
Subject: PR 14730
I've spent some time looking into this PR.
The problem stems from the fact that the switch's controlling
expression (an expression of type char in the test case) generates a
cast to int early in tree production, but the cast is later optimised
away. Without the cast, the case label value 256 overflows a char,
becomes a case label value 0 and the case range is miscalculated.
Things quickly go south from there.
T.0_2 = (int)i_1;
switch (T.0_2)
{
case 1: goto <L0>;
case 7: goto <L0>;
case 10: goto <L0>;
case 14: goto <L0>;
case 9: goto <L0>;
case 256: goto <L0>;
default : goto <L6>;
}
After optimisations are applied, the tree looks like this:
switch (i_1)
{
case 1: goto <L0>;
case 7: goto <L0>;
case 10: goto <L0>;
case 14: goto <L0>;
case 9: goto <L0>;
case 256: goto <L0>;
default : goto <L6>;
}
It seems that one of the optimisers is removing the T.0_2 variable and
the cast. I'll keep digging.
Ben
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14730
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14730] [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher
2004-03-25 5:15 [Bug middle-end/14730] New: [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher pinskia at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-04-01 5:03 ` bje at au1 dot ibm dot com
@ 2004-04-01 7:18 ` bje at au1 dot ibm dot com
2004-04-02 5:38 ` bje at au1 dot ibm dot com
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: bje at au1 dot ibm dot com @ 2004-04-01 7:18 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bje at au1 dot ibm dot com 2004-04-01 07:18 -------
Subject: PR 14730
The bug originator says that he expects that the out-of-range case
label would be optimised away, however I feel that we should focus on
getting tree-ssa to not regress from the mainline at this stage (which
retains the case 256 label and promotes the controlling expression to
int).
The dce2 pass is removing the cast:
Eliminating unnecessary statements:
Deleting : T.0_2 = (int)i_1;
Ben
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14730
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14730] [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher
2004-03-25 5:15 [Bug middle-end/14730] New: [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher pinskia at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-04-01 7:18 ` bje at au1 dot ibm dot com
@ 2004-04-02 5:38 ` bje at au1 dot ibm dot com
2004-04-21 1:04 ` cvs-commit at gcc dot gnu dot org
2004-04-21 1:04 ` bje at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: bje at au1 dot ibm dot com @ 2004-04-02 5:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bje at au1 dot ibm dot com 2004-04-02 05:37 -------
Subject: PR 14730
I've tracked down the source of this problem and have fixed it with a
crude patch. I'm now working on a refined patch.
Ben
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14730
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14730] [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher
2004-03-25 5:15 [Bug middle-end/14730] New: [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher pinskia at gcc dot gnu dot org
` (6 preceding siblings ...)
2004-04-21 1:04 ` cvs-commit at gcc dot gnu dot org
@ 2004-04-21 1:04 ` bje at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: bje at gcc dot gnu dot org @ 2004-04-21 1:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bje at gcc dot gnu dot org 2004-04-20 23:51 -------
Fixed by this patch:
2004-04-21 Ben Elliston <bje@au.ibm.com>
PR middle-end/14730
* expr.c (expand_expr_real_1) <SWITCH_EXPR>: Discard out of bounds
case label values and ranges. Saturate case range values that
exceed the minimum or maximum permitted value for the controlling
expression type to TYPE_MIN_VALUE or TYPE_MAX_VALUE.
[testsuite]
2004-04-21 Ben Elliston <bje@au.ibm.com>
PR middle-end/14730
* gcc.c-torture/compile/pr14730.c: New test.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14730
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/14730] [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher
2004-03-25 5:15 [Bug middle-end/14730] New: [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher pinskia at gcc dot gnu dot org
` (5 preceding siblings ...)
2004-04-02 5:38 ` bje at au1 dot ibm dot com
@ 2004-04-21 1:04 ` cvs-commit at gcc dot gnu dot org
2004-04-21 1:04 ` bje at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-04-21 1:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-04-20 23:47 -------
Subject: Bug 14730
CVSROOT: /cvs/gcc
Module name: gcc
Branch: tree-ssa-20020619-branch
Changes by: bje@gcc.gnu.org 2004-04-20 23:47:40
Modified files:
gcc : ChangeLog.tree-ssa expr.c
gcc/testsuite : ChangeLog.tree-ssa
Added files:
gcc/testsuite/gcc.c-torture/compile: pr14730.c
Log message:
2004-04-21 Ben Elliston <bje@au.ibm.com>
PR middle-end/14730
* expr.c (expand_expr_real_1) <SWITCH_EXPR>: Discard out of bounds
case label values and ranges. Saturate case range values that
exceed the minimum or maximum permitted value for the controlling
expression type to TYPE_MIN_VALUE or TYPE_MAX_VALUE.
[testsuite]
2004-04-21 Ben Elliston <bje@au.ibm.com>
PR middle-end/14730
* gcc.c-torture/compile/pr14730.c: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.tree-ssa.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.1341&r2=1.1.2.1342
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.467.2.86&r2=1.467.2.87
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.tree-ssa.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.224&r2=1.1.2.225
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr14730.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=NONE&r2=1.1.2.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14730
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2004-04-20 23:51 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-25 5:15 [Bug middle-end/14730] New: [tree-ssa] ICE on a switch statement with a case which is bigger than the type of switcher pinskia at gcc dot gnu dot org
2004-03-25 6:48 ` [Bug middle-end/14730] " pinskia at gcc dot gnu dot org
2004-03-25 9:55 ` falk at debian dot org
2004-03-29 23:58 ` bje at gcc dot gnu dot org
2004-04-01 5:03 ` bje at au1 dot ibm dot com
2004-04-01 7:18 ` bje at au1 dot ibm dot com
2004-04-02 5:38 ` bje at au1 dot ibm dot com
2004-04-21 1:04 ` cvs-commit at gcc dot gnu dot org
2004-04-21 1:04 ` bje 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).