public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/29715] New: fold produces &a - 4
@ 2006-11-04 21:30 pinskia at gcc dot gnu dot org
2006-11-04 21:34 ` [Bug middle-end/29715] middle-end " pinskia at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-04 21:30 UTC (permalink / raw)
To: gcc-bugs
Take this valid testcase:
int main ()
{
static int a[] = { 0, 1, 2 };
int *i = a+3;
if (i-- > a)
return 0;
return 0;
}
In the IR (in .orginal) we get:
if ( --i > &a - 4B)
which is incorrect and not really defined.
--
Summary: fold produces &a - 4
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
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=29715
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/29715] middle-end produces &a - 4
2006-11-04 21:30 [Bug middle-end/29715] New: fold produces &a - 4 pinskia at gcc dot gnu dot org
@ 2006-11-04 21:34 ` pinskia at gcc dot gnu dot org
2007-02-27 6:55 ` [Bug middle-end/29715] fold " pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-04 21:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-11-04 21:34 -------
Note: I found this while implementing PTR_PLUS_EXPR but that is because I did
not fix the part which does this optimization.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|fold produces &a - 4 |middle-end produces &a - 4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29715
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/29715] fold produces &a - 4
2006-11-04 21:30 [Bug middle-end/29715] New: fold produces &a - 4 pinskia at gcc dot gnu dot org
2006-11-04 21:34 ` [Bug middle-end/29715] middle-end " pinskia at gcc dot gnu dot org
@ 2007-02-27 6:55 ` pinskia at gcc dot gnu dot org
2007-02-27 7:01 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-27 6:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-02-27 06:55 -------
The comment from the code:
For pointer types we assume overflow doesn't happen.
That is true but you can cause an overflow to happen when you transform the
code this way.
Mine, I have a fix.
--
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|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-02-27 06:55:50
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29715
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/29715] fold produces &a - 4
2006-11-04 21:30 [Bug middle-end/29715] New: fold produces &a - 4 pinskia at gcc dot gnu dot org
2006-11-04 21:34 ` [Bug middle-end/29715] middle-end " pinskia at gcc dot gnu dot org
2007-02-27 6:55 ` [Bug middle-end/29715] fold " pinskia at gcc dot gnu dot org
@ 2007-02-27 7:01 ` pinskia at gcc dot gnu dot org
2007-05-02 17:48 ` pinskia at gcc dot gnu dot org
2007-05-02 17:49 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-27 7:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2007-02-27 07:01 -------
Before we would produce:
i = &a + 12B;
i = i - 4B;
D.1616 = &a - 4B;
if (i > D.1616)
Now we produce:
i = &a + 12B;
D.1620 = i > &a;
i = i - 4B;
if (D.1620)
Which is better because we can actually fold it down to return 0.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29715
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/29715] fold produces &a - 4
2006-11-04 21:30 [Bug middle-end/29715] New: fold produces &a - 4 pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-02-27 7:01 ` pinskia at gcc dot gnu dot org
@ 2007-05-02 17:48 ` pinskia at gcc dot gnu dot org
2007-05-02 17:49 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-02 17:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2007-05-02 18:48 -------
Subject: Bug 29715
Author: pinskia
Date: Wed May 2 17:47:50 2007
New Revision: 124354
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124354
Log:
Forgot to add the PR number to the last changelog entry:
2007-05-02 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/29715
* fold-const.c (fold_comparision): Remove the "foo++ == CONST"
transformation.
Modified:
trunk/gcc/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29715
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/29715] fold produces &a - 4
2006-11-04 21:30 [Bug middle-end/29715] New: fold produces &a - 4 pinskia at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-05-02 17:48 ` pinskia at gcc dot gnu dot org
@ 2007-05-02 17:49 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-02 17:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2007-05-02 18:49 -------
Fixed.
--
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=29715
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-05-02 17:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-04 21:30 [Bug middle-end/29715] New: fold produces &a - 4 pinskia at gcc dot gnu dot org
2006-11-04 21:34 ` [Bug middle-end/29715] middle-end " pinskia at gcc dot gnu dot org
2007-02-27 6:55 ` [Bug middle-end/29715] fold " pinskia at gcc dot gnu dot org
2007-02-27 7:01 ` pinskia at gcc dot gnu dot org
2007-05-02 17:48 ` pinskia at gcc dot gnu dot org
2007-05-02 17:49 ` 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).