public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21015] New: Bad loop optimization with -O2
@ 2005-04-14  0:31 phil at fifi dot org
  2005-04-14  0:32 ` [Bug rtl-optimization/21015] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: phil at fifi dot org @ 2005-04-14  0:31 UTC (permalink / raw)
  To: gcc-bugs

The enclosed program prints only "0" when compiled with -O2.  It should print
"0" and "1".  I've also tried 3.2.2 and the error is present.

Phil.

#include <stdio.h>

void
f(int start)
{
  int i, end;

  for (i = end = start; i <= end; ++i)
    {
      printf("%d\n", i);
      if (i == start)
	end = 1;
    }
}

int
main()
{
  f(0);
  return 0;
}

-- 
           Summary: Bad loop optimization with -O2
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: phil at fifi dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-redhat-linux-gnu
  GCC host triplet: i686-redhat-linux-gnu
GCC target triplet: i686-redhat-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21015


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/21015] Bad loop optimization with -O2
  2005-04-14  0:31 [Bug c/21015] New: Bad loop optimization with -O2 phil at fifi dot org
@ 2005-04-14  0:32 ` pinskia at gcc dot gnu dot org
  2005-04-14  0:34 ` [Bug rtl-optimization/21015] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-14  0:32 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |rtl-optimization
           Keywords|                            |wrong-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21015


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/21015] [3.3/3.4 Regression] Bad loop optimization with -O2
  2005-04-14  0:31 [Bug c/21015] New: Bad loop optimization with -O2 phil at fifi dot org
  2005-04-14  0:32 ` [Bug rtl-optimization/21015] " pinskia at gcc dot gnu dot org
@ 2005-04-14  0:34 ` pinskia at gcc dot gnu dot org
  2005-04-14  8:19 ` reichelt at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-14  0:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-14 00:34 -------
Confirmed, only a regression on the 3.4 branch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |3.3.3 3.4.0
      Known to work|                            |2.95.3 4.0.0 4.1.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-04-14 00:34:43
               date|                            |
            Summary|Bad loop optimization with -|[3.3/3.4 Regression] Bad
                   |O2                          |loop optimization with -O2
   Target Milestone|---                         |3.4.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21015


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/21015] [3.3/3.4 Regression] Bad loop optimization with -O2
  2005-04-14  0:31 [Bug c/21015] New: Bad loop optimization with -O2 phil at fifi dot org
  2005-04-14  0:32 ` [Bug rtl-optimization/21015] " pinskia at gcc dot gnu dot org
  2005-04-14  0:34 ` [Bug rtl-optimization/21015] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2005-04-14  8:19 ` reichelt at gcc dot gnu dot org
  2005-04-14  8:44 ` bonzini at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-04-14  8:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-04-14 08:19 -------
The compiler fails since gcc 3.0.

Looks very similar to PR 17860.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
  BugsThisDependsOn|                            |17860
           Keywords|                            |monitored
      Known to fail|3.3.3 3.4.0                 |3.3.3 3.4.0 3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21015


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/21015] [3.3/3.4 Regression] Bad loop optimization with -O2
  2005-04-14  0:31 [Bug c/21015] New: Bad loop optimization with -O2 phil at fifi dot org
                   ` (2 preceding siblings ...)
  2005-04-14  8:19 ` reichelt at gcc dot gnu dot org
@ 2005-04-14  8:44 ` bonzini at gcc dot gnu dot org
  2005-04-14  9:25 ` reichelt at igpm dot rwth-aachen dot de
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-04-14  8:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bonzini at gcc dot gnu dot org  2005-04-14 08:44 -------
Does the patch there fix it?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21015


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/21015] [3.3/3.4 Regression] Bad loop optimization with -O2
  2005-04-14  0:31 [Bug c/21015] New: Bad loop optimization with -O2 phil at fifi dot org
                   ` (3 preceding siblings ...)
  2005-04-14  8:44 ` bonzini at gcc dot gnu dot org
@ 2005-04-14  9:25 ` reichelt at igpm dot rwth-aachen dot de
  2005-05-19 17:24 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at igpm dot rwth-aachen dot de @ 2005-04-14  9:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at igpm dot rwth-aachen dot de  2005-04-14 09:25 -------
Subject: Re:  [3.3/3.4 Regression] Bad loop
 optimization with -O2

On 14 Apr, bonzini at gcc dot gnu dot org wrote:
> Does the patch there fix it?

Alas not.




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21015


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/21015] [3.3/3.4 Regression] Bad loop optimization with -O2
  2005-04-14  0:31 [Bug c/21015] New: Bad loop optimization with -O2 phil at fifi dot org
                   ` (4 preceding siblings ...)
  2005-04-14  9:25 ` reichelt at igpm dot rwth-aachen dot de
@ 2005-05-19 17:24 ` mmitchel at gcc dot gnu dot org
  2005-05-24  8:32 ` [Bug rtl-optimization/21015] [3.4 " reichelt at gcc dot gnu dot org
  2005-08-09  8:23 ` bonzini at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-19 17:24 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.4                       |3.4.5


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21015


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/21015] [3.4 Regression] Bad loop optimization with -O2
  2005-04-14  0:31 [Bug c/21015] New: Bad loop optimization with -O2 phil at fifi dot org
                   ` (5 preceding siblings ...)
  2005-05-19 17:24 ` mmitchel at gcc dot gnu dot org
@ 2005-05-24  8:32 ` reichelt at gcc dot gnu dot org
  2005-08-09  8:23 ` bonzini at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-05-24  8:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-05-24 08:12 -------
Fixed by Ulrich's patch
http://gcc.gnu.org/ml/gcc-patches/2005-05/msg00950.html
http://gcc.gnu.org/ml/gcc-cvs/2005-05/msg01066.html


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uweigand at gcc dot gnu dot
                   |                            |org
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21015


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/21015] [3.4 Regression] Bad loop optimization with -O2
  2005-04-14  0:31 [Bug c/21015] New: Bad loop optimization with -O2 phil at fifi dot org
                   ` (6 preceding siblings ...)
  2005-05-24  8:32 ` [Bug rtl-optimization/21015] [3.4 " reichelt at gcc dot gnu dot org
@ 2005-08-09  8:23 ` bonzini at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-08-09  8:23 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 21015 depends on bug 17860, which changed state.

Bug 17860 Summary: [3.4 only] Wrong generated code for loop with varying bound
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17860

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21015


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-08-09  8:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-14  0:31 [Bug c/21015] New: Bad loop optimization with -O2 phil at fifi dot org
2005-04-14  0:32 ` [Bug rtl-optimization/21015] " pinskia at gcc dot gnu dot org
2005-04-14  0:34 ` [Bug rtl-optimization/21015] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
2005-04-14  8:19 ` reichelt at gcc dot gnu dot org
2005-04-14  8:44 ` bonzini at gcc dot gnu dot org
2005-04-14  9:25 ` reichelt at igpm dot rwth-aachen dot de
2005-05-19 17:24 ` mmitchel at gcc dot gnu dot org
2005-05-24  8:32 ` [Bug rtl-optimization/21015] [3.4 " reichelt at gcc dot gnu dot org
2005-08-09  8:23 ` bonzini 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).