public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/28386] New: [4.1 regression] Wrong code with if condition in loop
@ 2006-07-14 20:02 reichelt at gcc dot gnu dot org
2006-07-14 20:10 ` [Bug tree-optimization/28386] " reichelt at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-07-14 20:02 UTC (permalink / raw)
To: gcc-bugs
Consider the following testcase - a variant from
http://gcc.gnu.org/ml/gcc-help/2006-07/msg00177.html :
=========================================================
#include <stdio.h>
volatile char s[256][3];
int main()
{
int i, j=0;
for (i = 0; i < 256; i++)
if (i >= 128 && i < 256)
{ printf("%d ", s[i - 128][0]); ++j; }
printf("\nj = %d\n", j);
return 0;
}
=========================================================
This program should generate the following output
(wrapped to 80 characters per line):
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
j = 128
With -Os I get the output
-125 4 -21 -8 -16 93 -119 -24 0 -127 17 80 -2 89 -61 3 0 2 100 10 61 100 0 0 0
0
-107 0 0 0 0 12 0 4 0 -108 8 0 -127 5 0 4 0 112 8 0 0 11 0 0 0 -28 64 0 -107 2
0 0 0 17 0 0 -126 17 0 4 0 8 0 0 0 -2 111 4 -1 1 0 -1 -126 0 0 0 0 0 0 0 0 0 0
0
0 0 0 0 0 -1 -1 0 -1 0 0 0 -108 -8 64 0 -52 -80 64 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
j = 255
Parts of the if-condition ionside the loop have been optimized out.
Happens only on the 4.1 branch.
--
Summary: [4.1 regression] Wrong code with if condition in loop
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: wrong-code, monitored
Severity: blocker
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28386
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/28386] [4.1 regression] Wrong code with if condition in loop
2006-07-14 20:02 [Bug tree-optimization/28386] New: [4.1 regression] Wrong code with if condition in loop reichelt at gcc dot gnu dot org
@ 2006-07-14 20:10 ` reichelt at gcc dot gnu dot org
2006-07-15 11:40 ` [Bug rtl-optimization/28386] " rguenth at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-07-14 20:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from reichelt at gcc dot gnu dot org 2006-07-14 20:10 -------
Confirmed.
--
reichelt 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-07-14 20:10:03
date| |
Target Milestone|--- |4.1.2
Version|unknown |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28386
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/28386] [4.1 regression] Wrong code with if condition in loop
2006-07-14 20:02 [Bug tree-optimization/28386] New: [4.1 regression] Wrong code with if condition in loop reichelt at gcc dot gnu dot org
2006-07-14 20:10 ` [Bug tree-optimization/28386] " reichelt at gcc dot gnu dot org
@ 2006-07-15 11:40 ` rguenth at gcc dot gnu dot org
2006-07-15 11:54 ` rguenth at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-07-15 11:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2006-07-15 11:40 -------
This is going wrong in RTL land. Tree optimization looks ok - we're merging
the
two IVs and using a wrapping unsigned IV going from 0xffffff81 to 127:
<bb 0>:
ivtmp.33D.1833 = 0ffffff81;
jD.1769 = 0;
<L0>:;
if (ivtmp.33D.1833 <= 127) goto <L1>; else goto <L2>;
<L1>:;
D.1775 = (intD.0) ivtmp.33D.1833;
D.1776 = sD.1765[D.1775][0];
printf (&"%d "[0], (intD.0) D.1776);
jD.1769 = jD.1769 + 1;
<L2>:;
ivtmp.33D.1833 = ivtmp.33D.1833 + 1;
if (ivtmp.33D.1833 != 128) goto <L0>; else goto <L4>;
<L4>:;
printf (&"\nj = %d\n"[0], jD.1769);
return 0;
of course, it's the particular choice of IVs that triggers the bug later on.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org
Component|tree-optimization |rtl-optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28386
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/28386] [4.1 regression] Wrong code with if condition in loop
2006-07-14 20:02 [Bug tree-optimization/28386] New: [4.1 regression] Wrong code with if condition in loop reichelt at gcc dot gnu dot org
2006-07-14 20:10 ` [Bug tree-optimization/28386] " reichelt at gcc dot gnu dot org
2006-07-15 11:40 ` [Bug rtl-optimization/28386] " rguenth at gcc dot gnu dot org
@ 2006-07-15 11:54 ` rguenth at gcc dot gnu dot org
2006-08-11 7:31 ` ebotcazou at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-07-15 11:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from rguenth at gcc dot gnu dot org 2006-07-15 11:54 -------
Goes away with -floop-optimize2. *sigh*
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rakdver at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28386
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/28386] [4.1 regression] Wrong code with if condition in loop
2006-07-14 20:02 [Bug tree-optimization/28386] New: [4.1 regression] Wrong code with if condition in loop reichelt at gcc dot gnu dot org
` (2 preceding siblings ...)
2006-07-15 11:54 ` rguenth at gcc dot gnu dot org
@ 2006-08-11 7:31 ` ebotcazou at gcc dot gnu dot org
2006-09-05 7:07 ` ebotcazou at gcc dot gnu dot org
2006-09-05 7:08 ` ebotcazou at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-08-11 7:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from ebotcazou at gcc dot gnu dot org 2006-08-11 07:31 -------
Investigating.
--
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |ebotcazou at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2006-07-14 20:10:03 |2006-08-11 07:31:09
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28386
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/28386] [4.1 regression] Wrong code with if condition in loop
2006-07-14 20:02 [Bug tree-optimization/28386] New: [4.1 regression] Wrong code with if condition in loop reichelt at gcc dot gnu dot org
` (3 preceding siblings ...)
2006-08-11 7:31 ` ebotcazou at gcc dot gnu dot org
@ 2006-09-05 7:07 ` ebotcazou at gcc dot gnu dot org
2006-09-05 7:08 ` ebotcazou at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-09-05 7:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from ebotcazou at gcc dot gnu dot org 2006-09-05 07:06 -------
Subject: Bug 28386
Author: ebotcazou
Date: Tue Sep 5 07:06:46 2006
New Revision: 116693
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116693
Log:
PR rtl-optimization/28386
* loop.c (biased_biv_may_wrap_p): Rename to biv_may_wrap_p and
remove 'bias' parameter.
(maybe_eliminate_biv_1): Adjust for above change.
Added:
branches/gcc-4_1-branch/gcc/testsuite/gcc.c-torture/execute/20060905-1.c
Modified:
branches/gcc-4_1-branch/gcc/ChangeLog
branches/gcc-4_1-branch/gcc/loop.c
branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28386
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/28386] [4.1 regression] Wrong code with if condition in loop
2006-07-14 20:02 [Bug tree-optimization/28386] New: [4.1 regression] Wrong code with if condition in loop reichelt at gcc dot gnu dot org
` (4 preceding siblings ...)
2006-09-05 7:07 ` ebotcazou at gcc dot gnu dot org
@ 2006-09-05 7:08 ` ebotcazou at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-09-05 7:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from ebotcazou at gcc dot gnu dot org 2006-09-05 07:08 -------
Fixed in upcoming 4.1.2 release.
--
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28386
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-09-05 7:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-14 20:02 [Bug tree-optimization/28386] New: [4.1 regression] Wrong code with if condition in loop reichelt at gcc dot gnu dot org
2006-07-14 20:10 ` [Bug tree-optimization/28386] " reichelt at gcc dot gnu dot org
2006-07-15 11:40 ` [Bug rtl-optimization/28386] " rguenth at gcc dot gnu dot org
2006-07-15 11:54 ` rguenth at gcc dot gnu dot org
2006-08-11 7:31 ` ebotcazou at gcc dot gnu dot org
2006-09-05 7:07 ` ebotcazou at gcc dot gnu dot org
2006-09-05 7:08 ` ebotcazou 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).