public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy
@ 2006-02-13 15:20 rguenth at gcc dot gnu dot org
2006-02-13 15:24 ` [Bug tree-optimization/26258] " pinskia at gcc dot gnu dot org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-13 15:20 UTC (permalink / raw)
To: gcc-bugs
Compiling with -O2 the following creates invalid virtual operands after
SRA:
struct Foo { int a; int b; };
Foo foo(Foo p, bool ret_first)
{
Foo first = p;
Foo last = p;
return ret_first ? first : last;
}
# iftmp.0D.1761_1 = PHI <&firstD.1740(1), &lastD.1757(0)>;
<L2>:;
# VUSE <SFT.6D.1783_24>;
# VUSE <SFT.8D.1785_26>;
SR.26D.1803_27 = iftmp.0D.1761_1->bD.1735;
# VUSE <SFT.6D.1783_24>;
# VUSE <SFT.8D.1785_26>;
SR.25D.1802_28 = iftmp.0D.1761_1->aD.1734;
the access to ->b should VUSE SFTs 5 and 7.
--
Summary: [4.1 Regression] Wrong alias information for SRAed
struct copy
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: wrong-code, alias
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/26258] [4.1 Regression] Wrong alias information for SRAed struct copy
2006-02-13 15:20 [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy rguenth at gcc dot gnu dot org
@ 2006-02-13 15:24 ` pinskia at gcc dot gnu dot org
2006-02-13 15:31 ` rguenth at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-13 15:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-02-13 15:24 -------
C testcase works correctly.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|4.1.0 |
Known to work|4.2.0 4.0.3 |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/26258] [4.1 Regression] Wrong alias information for SRAed struct copy
2006-02-13 15:20 [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy rguenth at gcc dot gnu dot org
2006-02-13 15:24 ` [Bug tree-optimization/26258] " pinskia at gcc dot gnu dot org
@ 2006-02-13 15:31 ` rguenth at gcc dot gnu dot org
2006-02-13 15:32 ` [Bug tree-optimization/26258] [4.1 Regression] Wrong alias information for struct pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-13 15:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2006-02-13 15:31 -------
C testcase that fails (the PHI <&first, &last> is the important part):
typedef struct { int a; int b; } Foo;
Foo foo(Foo p, _Bool ret_first)
{
Foo first = p;
Foo last = p;
Foo *q;
q = ret_first ? &first : &last;
return *q;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/26258] [4.1 Regression] Wrong alias information for struct
2006-02-13 15:20 [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy rguenth at gcc dot gnu dot org
2006-02-13 15:24 ` [Bug tree-optimization/26258] " pinskia at gcc dot gnu dot org
2006-02-13 15:31 ` rguenth at gcc dot gnu dot org
@ 2006-02-13 15:32 ` pinskia at gcc dot gnu dot org
2006-02-13 15:37 ` [Bug tree-optimization/26258] [4.1/4.2 " pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-13 15:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-02-13 15:32 -------
You can invoke the wrong aliasing before SRA:
typedef struct Foo { int a; int b; }Foo;
Foo foo(Foo first, Foo last, bool ret_first)
{
Foo t;
Foo *t1 = (ret_first ? &first : &last);
t.a = t1->a;
t.b = t1->b;
return t;
}
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.1 Regression] Wrong alias|[4.1 Regression] Wrong alias
|information for SRAed struct|information for struct
|copy |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/26258] [4.1/4.2 Regression] Wrong alias information for struct
2006-02-13 15:20 [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy rguenth at gcc dot gnu dot org
` (3 preceding siblings ...)
2006-02-13 15:37 ` [Bug tree-optimization/26258] [4.1/4.2 " pinskia at gcc dot gnu dot org
@ 2006-02-13 15:37 ` pinskia at gcc dot gnu dot org
2006-02-13 15:42 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-13 15:37 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/26258] [4.1/4.2 Regression] Wrong alias information for struct
2006-02-13 15:20 [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy rguenth at gcc dot gnu dot org
` (2 preceding siblings ...)
2006-02-13 15:32 ` [Bug tree-optimization/26258] [4.1 Regression] Wrong alias information for struct pinskia at gcc dot gnu dot org
@ 2006-02-13 15:37 ` pinskia at gcc dot gnu dot org
2006-02-13 15:37 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-13 15:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2006-02-13 15:37 -------
Testcase for the mainline:
typedef struct Foo { int a; int b; }Foo;
Foo foo(Foo first, Foo last, bool ret_first)
{
Foo t;
Foo *t1 = (ret_first ? &first : &last);
first.a = 2;
last.b = 3;
t.a = t1->a;
t.b = t1->b;
t.a += first.a;
t.b += last.b;
return t;
}
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-02-13 15:37:29
date| |
Summary|[4.1 Regression] Wrong alias|[4.1/4.2 Regression] Wrong
|information for struct |alias information for struct
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/26258] [4.1/4.2 Regression] Wrong alias information for struct
2006-02-13 15:20 [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy rguenth at gcc dot gnu dot org
` (4 preceding siblings ...)
2006-02-13 15:37 ` pinskia at gcc dot gnu dot org
@ 2006-02-13 15:42 ` pinskia at gcc dot gnu dot org
2006-02-13 15:44 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-13 15:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2006-02-13 15:42 -------
For the testcase in comment #4:
Points-to analysis
Constraints:
t1_1 = &first
t1_1 = &last
Solving graph:
Points-to sets
t1_1 = { first last }
Pointed-to sets for pointers in foo
t1_1, name memory tag: NMT.17, is dereferenced, points-to vars: { SFT.4 SFT.6 }
----
t1_1 is wrong in "Pointed-to sets for pointers in foo". maybe we forget to add
all the SFT's or something.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/26258] [4.1/4.2 Regression] Wrong alias information for struct
2006-02-13 15:20 [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy rguenth at gcc dot gnu dot org
` (5 preceding siblings ...)
2006-02-13 15:42 ` pinskia at gcc dot gnu dot org
@ 2006-02-13 15:44 ` pinskia at gcc dot gnu dot org
2006-02-13 16:25 ` [Bug tree-optimization/26258] [4.1/4.2 Regression] Wrong alias information for struct addresses in PHIs rguenth at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-13 15:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pinskia at gcc dot gnu dot org 2006-02-13 15:44 -------
Actually contstraints is wrong.
in the first aliasing pass before proping into the addresses into PHI's:
iftmp.0_25 = &first
iftmp.0_25 = &first.b
iftmp.0_24 = &last
iftmp.0_24 = &last.b
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/26258] [4.1/4.2 Regression] Wrong alias information for struct addresses in PHIs
2006-02-13 15:20 [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy rguenth at gcc dot gnu dot org
` (6 preceding siblings ...)
2006-02-13 15:44 ` pinskia at gcc dot gnu dot org
@ 2006-02-13 16:25 ` rguenth at gcc dot gnu dot org
2006-02-14 9:08 ` mmitchel at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-13 16:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from rguenth at gcc dot gnu dot org 2006-02-13 16:25 -------
I have a patch.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2006-02-13 15:37:29 |2006-02-13 16:25:48
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/26258] [4.1/4.2 Regression] Wrong alias information for struct addresses in PHIs
2006-02-13 15:20 [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy rguenth at gcc dot gnu dot org
` (7 preceding siblings ...)
2006-02-13 16:25 ` [Bug tree-optimization/26258] [4.1/4.2 Regression] Wrong alias information for struct addresses in PHIs rguenth at gcc dot gnu dot org
@ 2006-02-14 9:08 ` mmitchel at gcc dot gnu dot org
2006-02-14 9:54 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-02-14 9:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from mmitchel at gcc dot gnu dot org 2006-02-14 09:08 -------
Sadly, this is a P1; a nasty optimization bug, on code without extensions,
probably architecture independent, and did not exist in previous releases.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|rguenth at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/26258] [4.1/4.2 Regression] Wrong alias information for struct addresses in PHIs
2006-02-13 15:20 [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy rguenth at gcc dot gnu dot org
` (8 preceding siblings ...)
2006-02-14 9:08 ` mmitchel at gcc dot gnu dot org
@ 2006-02-14 9:54 ` rguenth at gcc dot gnu dot org
2006-02-14 9:59 ` rguenth at gcc dot gnu dot org
2006-02-14 9:59 ` rguenth at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-14 9:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from rguenth at gcc dot gnu dot org 2006-02-14 09:54 -------
Subject: Bug 26258
Author: rguenth
Date: Tue Feb 14 09:54:07 2006
New Revision: 110962
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110962
Log:
2006-02-14 Richard Guenther <rguenther@suse.de>
PR tree-optimization/26258
* tree-ssa-structalias.c (find_func_aliases): Handle aggregates
in PHI argument processing.
* gcc.dg/torture/pr26258.c: New testcase.
Added:
branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/torture/pr26258.c
Modified:
branches/gcc-4_1-branch/gcc/ChangeLog
branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
branches/gcc-4_1-branch/gcc/tree-ssa-structalias.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/26258] [4.1/4.2 Regression] Wrong alias information for struct addresses in PHIs
2006-02-13 15:20 [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy rguenth at gcc dot gnu dot org
` (10 preceding siblings ...)
2006-02-14 9:59 ` rguenth at gcc dot gnu dot org
@ 2006-02-14 9:59 ` rguenth at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-14 9:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from rguenth at gcc dot gnu dot org 2006-02-14 09:59 -------
Subject: Bug 26258
Author: rguenth
Date: Tue Feb 14 09:58:57 2006
New Revision: 110963
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110963
Log:
2006-02-14 Richard Guenther <rguenther@suse.de>
PR tree-optimization/26258
* tree-ssa-structalias.c (find_func_aliases): Handle aggregates
in PHI argument processing.
* gcc.dg/torture/pr26258.c: New testcase.
Added:
trunk/gcc/testsuite/gcc.dg/torture/pr26258.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-structalias.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/26258] [4.1/4.2 Regression] Wrong alias information for struct addresses in PHIs
2006-02-13 15:20 [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy rguenth at gcc dot gnu dot org
` (9 preceding siblings ...)
2006-02-14 9:54 ` rguenth at gcc dot gnu dot org
@ 2006-02-14 9:59 ` rguenth at gcc dot gnu dot org
2006-02-14 9:59 ` rguenth at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-14 9:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from rguenth at gcc dot gnu dot org 2006-02-14 09:59 -------
Fixed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2006-02-14 9:59 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-13 15:20 [Bug tree-optimization/26258] New: [4.1 Regression] Wrong alias information for SRAed struct copy rguenth at gcc dot gnu dot org
2006-02-13 15:24 ` [Bug tree-optimization/26258] " pinskia at gcc dot gnu dot org
2006-02-13 15:31 ` rguenth at gcc dot gnu dot org
2006-02-13 15:32 ` [Bug tree-optimization/26258] [4.1 Regression] Wrong alias information for struct pinskia at gcc dot gnu dot org
2006-02-13 15:37 ` [Bug tree-optimization/26258] [4.1/4.2 " pinskia at gcc dot gnu dot org
2006-02-13 15:37 ` pinskia at gcc dot gnu dot org
2006-02-13 15:42 ` pinskia at gcc dot gnu dot org
2006-02-13 15:44 ` pinskia at gcc dot gnu dot org
2006-02-13 16:25 ` [Bug tree-optimization/26258] [4.1/4.2 Regression] Wrong alias information for struct addresses in PHIs rguenth at gcc dot gnu dot org
2006-02-14 9:08 ` mmitchel at gcc dot gnu dot org
2006-02-14 9:54 ` rguenth at gcc dot gnu dot org
2006-02-14 9:59 ` rguenth at gcc dot gnu dot org
2006-02-14 9:59 ` rguenth 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).