public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/29708] New: Alias can go funny with pointer addition
@ 2006-11-04 9:13 pinskia at gcc dot gnu dot org
2006-11-04 17:21 ` [Bug tree-optimization/29708] " rguenth at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-04 9:13 UTC (permalink / raw)
To: gcc-bugs
With the following testcase:
int a[100], b[100], d[100];
void link_error (void);
int g(int i, int j)
{
int *c;
int t;
c = i?a:b;
c++;
d[j] = 1;
c[j] = 2;
if (d[j] != 1)
link_error ();
return 0;
}
----
May-alias should figure out that c can only pointer to a or b but it gets
confused as we get:
j.2_11 = (unsigned int) j_7;
D.1537_12 = j.2_11 * 4;
D.1538_13 = (int *) D.1537_12;
D.1539_14 = D.1538_13 + c_6;
*D.1539_14 = 2;
as may-alias only looks at the left hand side of a PLUS expression, we get the
following result:
D.1538_13 = &ANYTHING
D.1539_14 = D.1538_13
Note 4.1 optimzed this testcase but I think that was by accident and is not
actually getting it correct.
If we add PTR_PLUS_EXPR we get the correct answer all the time unless someone
does some real weird tricks by doing something like:
size_t t = (size_t)a;
int *c = (int*)(size_t)j;
*(c+t) = 2;
--
Summary: Alias can go funny with pointer addition
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29708
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/29708] Alias can go funny with pointer addition
2006-11-04 9:13 [Bug tree-optimization/29708] New: Alias can go funny with pointer addition pinskia at gcc dot gnu dot org
@ 2006-11-04 17:21 ` rguenth at gcc dot gnu dot org
2007-05-22 0:52 ` pinskia at gcc dot gnu dot org
2007-06-16 5:50 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-11-04 17:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2006-11-04 17:21 -------
Confirmed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-11-04 17:21:20
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29708
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/29708] Alias can go funny with pointer addition
2006-11-04 9:13 [Bug tree-optimization/29708] New: Alias can go funny with pointer addition pinskia at gcc dot gnu dot org
2006-11-04 17:21 ` [Bug tree-optimization/29708] " rguenth at gcc dot gnu dot org
@ 2007-05-22 0:52 ` pinskia at gcc dot gnu dot org
2007-06-16 5:50 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-22 0:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-05-22 01:51 -------
Mine, we always get the correct answer on the pointer plus branch.
On the trunk:
ANYTHING = &ANYTHING
READONLY = &ANYTHING
INTEGER = &ANYTHING
a = &ANYTHING
c_1 = &a
b = &ANYTHING
c_1 = &b
c_6 = c_1 + 32
D.1639_11 = &ANYTHING
D.1640_12 = D.1639_11
D.1640_12 = c_6
*D.1640_12 = 2;
While on the branch:
ANYTHING = &ANYTHING
READONLY = &ANYTHING
INTEGER = &ANYTHING
a = &ANYTHING
c_1 = &a
b = &ANYTHING
c_1 = &b
c_6 = c_1 + 32
D.1639_11 = c_6
*D.1639_11 = 2;
So there is no extra Constraint for the store to &ANYTHING.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29708
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/29708] Alias can go funny with pointer addition
2006-11-04 9:13 [Bug tree-optimization/29708] New: Alias can go funny with pointer addition pinskia at gcc dot gnu dot org
2006-11-04 17:21 ` [Bug tree-optimization/29708] " rguenth at gcc dot gnu dot org
2007-05-22 0:52 ` pinskia at gcc dot gnu dot org
@ 2007-06-16 5:50 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-16 5:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2007-06-16 05:50 -------
Fixed at revision 125755.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29708
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-06-16 5:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-04 9:13 [Bug tree-optimization/29708] New: Alias can go funny with pointer addition pinskia at gcc dot gnu dot org
2006-11-04 17:21 ` [Bug tree-optimization/29708] " rguenth at gcc dot gnu dot org
2007-05-22 0:52 ` pinskia at gcc dot gnu dot org
2007-06-16 5:50 ` pinskia 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).