public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53168] New: ICE in find_or_generate_expression, at tree-ssa-pre.c:3053
@ 2012-04-30 13:43 regehr at cs dot utah.edu
2012-04-30 15:18 ` [Bug tree-optimization/53168] " jakub at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: regehr at cs dot utah.edu @ 2012-04-30 13:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53168
Bug #: 53168
Summary: ICE in find_or_generate_expression, at
tree-ssa-pre.c:3053
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: regehr@cs.utah.edu
CC: chenyang@cs.utah.edu
[regehr@dyson r44]$ current-gcc -c -O2 small.c
small.c: In function 'fn3':
small.c:7:1: internal compiler error: in find_or_generate_expression, at
tree-ssa-pre.c:3053
fn3 ()
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[regehr@dyson r44]$ cat small.c
int a, b, c;
unsigned *d;
int e[1];
void fn1 ();
int fn2 ();
int
fn3 ()
{
int *f = &a;
if (fn2 ())
{
for (; c; c++)
{
e[a] && (b = 0);
fn1 ();
if (e[a])
return 0;
}
for (; c <= 0; c++)
for (;;)
;
}
else
e[0] = 0 != (d = f);
return *d;
}
[regehr@dyson r44]$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r186954-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r186954-install
--program-prefix=r186954- --enable-languages=c,c++
Thread model: posix
gcc version 4.8.0 20120430 (experimental) (GCC)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/53168] ICE in find_or_generate_expression, at tree-ssa-pre.c:3053
2012-04-30 13:43 [Bug c/53168] New: ICE in find_or_generate_expression, at tree-ssa-pre.c:3053 regehr at cs dot utah.edu
@ 2012-04-30 15:18 ` jakub at gcc dot gnu.org
2012-05-02 10:31 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-04-30 15:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53168
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-04-30
Component|c |tree-optimization
CC| |jakub at gcc dot gnu.org
Ever Confirmed|0 |1
Target Milestone|--- |4.8.0
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-04-30 15:18:05 UTC ---
Started failing with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185691
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/53168] ICE in find_or_generate_expression, at tree-ssa-pre.c:3053
2012-04-30 13:43 [Bug c/53168] New: ICE in find_or_generate_expression, at tree-ssa-pre.c:3053 regehr at cs dot utah.edu
2012-04-30 15:18 ` [Bug tree-optimization/53168] " jakub at gcc dot gnu.org
@ 2012-05-02 10:31 ` rguenth at gcc dot gnu.org
2012-05-02 15:02 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-05-02 10:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53168
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org
|gnu.org |
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-02 10:31:23 UTC ---
Mine.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/53168] ICE in find_or_generate_expression, at tree-ssa-pre.c:3053
2012-04-30 13:43 [Bug c/53168] New: ICE in find_or_generate_expression, at tree-ssa-pre.c:3053 regehr at cs dot utah.edu
2012-04-30 15:18 ` [Bug tree-optimization/53168] " jakub at gcc dot gnu.org
2012-05-02 10:31 ` rguenth at gcc dot gnu.org
@ 2012-05-02 15:02 ` rguenth at gcc dot gnu.org
2012-05-03 8:32 ` steven at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-05-02 15:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53168
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |steven at gcc dot gnu.org
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-02 15:00:54 UTC ---
It's what I always wondered about ... we phi-translate again during
do_regular_insertion but we fail to "clean" the result in any way. So
we end with a translation result that is "invalid", thus one without
a leader and one which we cannot re-create. That is, valid_in_sets returns
false for it.
Index: gcc/tree-ssa-pre.c
===================================================================
--- gcc/tree-ssa-pre.c (revision 187042)
+++ gcc/tree-ssa-pre.c (working copy)
@@ -3617,6 +3619,11 @@ do_regular_insertion (basic_block block,
vprime, NULL);
if (edoubleprime == NULL)
{
+ if (!valid_in_sets (AVAIL_OUT (bprime), NULL, eprime,
bprime))
+ {
+ cant_insert = true;
+ break;
+ }
avail[bprime->index] = eprime;
all_same = false;
}
Steven - do you by chance remember why "re-translating" during insertion
is ok? Or is a phi-translation result that cannot be inserted in its
form at the end of the BB bogus (always? or only during insertion?).
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/53168] ICE in find_or_generate_expression, at tree-ssa-pre.c:3053
2012-04-30 13:43 [Bug c/53168] New: ICE in find_or_generate_expression, at tree-ssa-pre.c:3053 regehr at cs dot utah.edu
` (2 preceding siblings ...)
2012-05-02 15:02 ` rguenth at gcc dot gnu.org
@ 2012-05-03 8:32 ` steven at gcc dot gnu.org
2012-05-03 14:18 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu.org @ 2012-05-03 8:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53168
--- Comment #4 from Steven Bosscher <steven at gcc dot gnu.org> 2012-05-03 08:31:54 UTC ---
I don't remember. Did you look at the paper/thesis to see if it says anything
about this?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/53168] ICE in find_or_generate_expression, at tree-ssa-pre.c:3053
2012-04-30 13:43 [Bug c/53168] New: ICE in find_or_generate_expression, at tree-ssa-pre.c:3053 regehr at cs dot utah.edu
` (3 preceding siblings ...)
2012-05-03 8:32 ` steven at gcc dot gnu.org
@ 2012-05-03 14:18 ` rguenth at gcc dot gnu.org
2012-05-04 11:31 ` rguenth at gcc dot gnu.org
2012-05-04 11:36 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-05-03 14:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53168
--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-03 14:17:32 UTC ---
I think it is because of how we do VN lookup / insert during phi_translation.
SCCVN does not guarantee availability of its lookup result, thus when
such availability is not guaranteed when we translate things we should rather
use the non-canonical expression (after all we translate expressions (sic!),
not values).
What happens is that we have (simplified)
if (b)
{
x_1 = a;
}
else
{
if (c)
for(;;)
{
x_2 = a;
a = 0;
}
}
and SCCVN value-numbers x_2 to x_1. PRE sees that 'a' is ANTIC_IN in the
for (;;) block - but it's not ANTIC_OUT in the if (c) block because it
gets cleaned out there as it is translated as x_1 which is not insertable.
I think the PRE algorithm does not expect that phi_translate (ANTIC_IN (succ))
will ever return something that is _not_ valid at the ANTIC_OUT position.
But our phi-translate implementation happily causes this situation.
My suggested change to check validity of the phi_translate result at
insert time is a workaround, but it only makes this a missed optimization.
This particular case is fixed by not turning the memory reference into
a conversion on translation.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/53168] ICE in find_or_generate_expression, at tree-ssa-pre.c:3053
2012-04-30 13:43 [Bug c/53168] New: ICE in find_or_generate_expression, at tree-ssa-pre.c:3053 regehr at cs dot utah.edu
` (4 preceding siblings ...)
2012-05-03 14:18 ` rguenth at gcc dot gnu.org
@ 2012-05-04 11:31 ` rguenth at gcc dot gnu.org
2012-05-04 11:36 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-05-04 11:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53168
--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-04 11:30:39 UTC ---
Author: rguenth
Date: Fri May 4 11:30:35 2012
New Revision: 187153
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187153
Log:
2012-05-04 Richard Guenther <rguenther@suse.de>
PR tree-optimization/53168
* tree-ssa-pre.c (phi_translate_1): Only handle type-punned
memory reads when the result is a constant we can pun.
* gcc.dg/torture/pr53168.c: New testcase.
* gcc.dg/tree-ssa/ssa-pre-30.c: Likewise.
Added:
trunk/gcc/testsuite/gcc.dg/torture/pr53168.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-30.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-pre.c
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/53168] ICE in find_or_generate_expression, at tree-ssa-pre.c:3053
2012-04-30 13:43 [Bug c/53168] New: ICE in find_or_generate_expression, at tree-ssa-pre.c:3053 regehr at cs dot utah.edu
` (5 preceding siblings ...)
2012-05-04 11:31 ` rguenth at gcc dot gnu.org
@ 2012-05-04 11:36 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-05-04 11:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53168
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-04 11:35:25 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-05-04 11:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-30 13:43 [Bug c/53168] New: ICE in find_or_generate_expression, at tree-ssa-pre.c:3053 regehr at cs dot utah.edu
2012-04-30 15:18 ` [Bug tree-optimization/53168] " jakub at gcc dot gnu.org
2012-05-02 10:31 ` rguenth at gcc dot gnu.org
2012-05-02 15:02 ` rguenth at gcc dot gnu.org
2012-05-03 8:32 ` steven at gcc dot gnu.org
2012-05-03 14:18 ` rguenth at gcc dot gnu.org
2012-05-04 11:31 ` rguenth at gcc dot gnu.org
2012-05-04 11:36 ` rguenth 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).