public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/49161] New: [4.5/4.6/4.7 Regression] Fix VRP on switch stmts
@ 2011-05-25 14:09 jakub at gcc dot gnu.org
2011-05-25 14:13 ` [Bug tree-optimization/49161] " jakub at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-05-25 14:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49161
Summary: [4.5/4.6/4.7 Regression] Fix VRP on switch stmts
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: jakub@gcc.gnu.org
ReportedBy: jakub@gcc.gnu.org
The following testcase is miscompiled at -O2 on x86_64/i686, starting with:
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155937
extern void abort (void);
int c;
__attribute__((noinline, noclone)) void
bar (int x)
{
if (x != c++)
abort ();
}
__attribute__((noinline, noclone)) void
foo (int x)
{
switch (x)
{
case 3: goto l1;
case 4: goto l2;
case 6: goto l3;
default: return;
}
l1:
goto l4;
l2:
goto l4;
l3:
bar (-1);
l4:
bar (0);
if (x != 4)
bar (1);
if (x != 3)
bar (-1);
bar (2);
}
int
main ()
{
foo (3);
if (c != 3)
abort ();
return 0;
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/49161] [4.5/4.6/4.7 Regression] Fix VRP on switch stmts
2011-05-25 14:09 [Bug tree-optimization/49161] New: [4.5/4.6/4.7 Regression] Fix VRP on switch stmts jakub at gcc dot gnu.org
@ 2011-05-25 14:13 ` jakub at gcc dot gnu.org
2011-05-25 14:24 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-05-25 14:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49161
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011.05.25 14:10:38
Known to work| |4.4.6
Target Milestone|--- |4.5.4
Ever Confirmed|0 |1
Known to fail| |4.5.3, 4.6.0, 4.7.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/49161] [4.5/4.6/4.7 Regression] Fix VRP on switch stmts
2011-05-25 14:09 [Bug tree-optimization/49161] New: [4.5/4.6/4.7 Regression] Fix VRP on switch stmts jakub at gcc dot gnu.org
2011-05-25 14:13 ` [Bug tree-optimization/49161] " jakub at gcc dot gnu.org
@ 2011-05-25 14:24 ` jakub at gcc dot gnu.org
2011-05-25 14:38 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-05-25 14:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49161
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-25 14:13:06 UTC ---
Created attachment 24356
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24356
gcc46-pr49161.patch
Untested fix. The problem seems to be that GIMPLE_SWITCH uses until VRP
different CASE_LABEL_EXPRs for the same bb, so it adds to the same edge
assertion that x == 4 and that x == 3, while instead x >= 3 and x <= 4
assertions should be added.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/49161] [4.5/4.6/4.7 Regression] Fix VRP on switch stmts
2011-05-25 14:09 [Bug tree-optimization/49161] New: [4.5/4.6/4.7 Regression] Fix VRP on switch stmts jakub at gcc dot gnu.org
2011-05-25 14:13 ` [Bug tree-optimization/49161] " jakub at gcc dot gnu.org
2011-05-25 14:24 ` jakub at gcc dot gnu.org
@ 2011-05-25 14:38 ` rguenth at gcc dot gnu.org
2011-05-26 10:14 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-25 14:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49161
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-25 14:35:14 UTC ---
Ick. The patch looks ok to me.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/49161] [4.5/4.6/4.7 Regression] Fix VRP on switch stmts
2011-05-25 14:09 [Bug tree-optimization/49161] New: [4.5/4.6/4.7 Regression] Fix VRP on switch stmts jakub at gcc dot gnu.org
` (2 preceding siblings ...)
2011-05-25 14:38 ` rguenth at gcc dot gnu.org
@ 2011-05-26 10:14 ` jakub at gcc dot gnu.org
2011-05-26 10:25 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-05-26 10:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49161
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-26 10:05:08 UTC ---
Author: jakub
Date: Thu May 26 10:05:05 2011
New Revision: 174270
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174270
Log:
PR tree-optimization/49161
* tree-vrp.c (struct case_info): New type.
(compare_case_labels): Sort case_info structs instead of
trees, and not primarily by CASE_LABEL uids but by
label_for_block indexes.
(find_switch_asserts): Put case labels into struct case_info
array instead of TREE_VEC, adjust sorting, compare label_for_block
values instead of CASE_LABELs.
* gcc.c-torture/execute/pr49161.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/execute/pr49161.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vrp.c
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/49161] [4.5/4.6/4.7 Regression] Fix VRP on switch stmts
2011-05-25 14:09 [Bug tree-optimization/49161] New: [4.5/4.6/4.7 Regression] Fix VRP on switch stmts jakub at gcc dot gnu.org
` (3 preceding siblings ...)
2011-05-26 10:14 ` jakub at gcc dot gnu.org
@ 2011-05-26 10:25 ` jakub at gcc dot gnu.org
2011-05-26 10:47 ` [Bug tree-optimization/49161] [4.5 " jakub at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-05-26 10:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49161
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-26 10:20:37 UTC ---
Author: jakub
Date: Thu May 26 10:20:34 2011
New Revision: 174272
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174272
Log:
PR tree-optimization/49161
* tree-vrp.c (struct case_info): New type.
(compare_case_labels): Sort case_info structs instead of
trees, and not primarily by CASE_LABEL uids but by
label_for_block indexes.
(find_switch_asserts): Put case labels into struct case_info
array instead of TREE_VEC, adjust sorting, compare label_for_block
values instead of CASE_LABELs.
* gcc.c-torture/execute/pr49161.c: New test.
Added:
branches/gcc-4_6-branch/gcc/testsuite/gcc.c-torture/execute/pr49161.c
Modified:
branches/gcc-4_6-branch/gcc/ChangeLog
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
branches/gcc-4_6-branch/gcc/tree-vrp.c
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/49161] [4.5 Regression] Fix VRP on switch stmts
2011-05-25 14:09 [Bug tree-optimization/49161] New: [4.5/4.6/4.7 Regression] Fix VRP on switch stmts jakub at gcc dot gnu.org
` (4 preceding siblings ...)
2011-05-26 10:25 ` jakub at gcc dot gnu.org
@ 2011-05-26 10:47 ` jakub at gcc dot gnu.org
2011-07-19 12:52 ` jakub at gcc dot gnu.org
2011-07-19 13:43 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-05-26 10:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49161
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.6.1, 4.7.0
Summary|[4.5/4.6/4.7 Regression] |[4.5 Regression] Fix VRP on
|Fix VRP on switch stmts |switch stmts
Known to fail|4.7.0 |
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-26 10:33:41 UTC ---
Fixed for 4.6+ so far.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/49161] [4.5 Regression] Fix VRP on switch stmts
2011-05-25 14:09 [Bug tree-optimization/49161] New: [4.5/4.6/4.7 Regression] Fix VRP on switch stmts jakub at gcc dot gnu.org
` (5 preceding siblings ...)
2011-05-26 10:47 ` [Bug tree-optimization/49161] [4.5 " jakub at gcc dot gnu.org
@ 2011-07-19 12:52 ` jakub at gcc dot gnu.org
2011-07-19 13:43 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-07-19 12:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49161
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-19 12:51:31 UTC ---
Author: jakub
Date: Tue Jul 19 12:51:29 2011
New Revision: 176451
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176451
Log:
Backport from mainline
2011-05-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/49161
* tree-vrp.c (struct case_info): New type.
(compare_case_labels): Sort case_info structs instead of
trees, and not primarily by CASE_LABEL uids but by
label_for_block indexes.
(find_switch_asserts): Put case labels into struct case_info
array instead of TREE_VEC, adjust sorting, compare label_for_block
values instead of CASE_LABELs.
* gcc.c-torture/execute/pr49161.c: New test.
Added:
branches/gcc-4_5-branch/gcc/testsuite/gcc.c-torture/execute/pr49161.c
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
branches/gcc-4_5-branch/gcc/tree-vrp.c
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/49161] [4.5 Regression] Fix VRP on switch stmts
2011-05-25 14:09 [Bug tree-optimization/49161] New: [4.5/4.6/4.7 Regression] Fix VRP on switch stmts jakub at gcc dot gnu.org
` (6 preceding siblings ...)
2011-07-19 12:52 ` jakub at gcc dot gnu.org
@ 2011-07-19 13:43 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-07-19 13:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49161
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-19 13:42:48 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-07-19 13:43 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-25 14:09 [Bug tree-optimization/49161] New: [4.5/4.6/4.7 Regression] Fix VRP on switch stmts jakub at gcc dot gnu.org
2011-05-25 14:13 ` [Bug tree-optimization/49161] " jakub at gcc dot gnu.org
2011-05-25 14:24 ` jakub at gcc dot gnu.org
2011-05-25 14:38 ` rguenth at gcc dot gnu.org
2011-05-26 10:14 ` jakub at gcc dot gnu.org
2011-05-26 10:25 ` jakub at gcc dot gnu.org
2011-05-26 10:47 ` [Bug tree-optimization/49161] [4.5 " jakub at gcc dot gnu.org
2011-07-19 12:52 ` jakub at gcc dot gnu.org
2011-07-19 13:43 ` jakub at gcc dot gnu.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).