public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/2512: optimization > -O gives incorrect loop processing (gcc, g++)
@ 2002-04-02  0:26 rth
  0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2002-04-02  0:26 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, linux62i, nobody

Synopsis: optimization > -O gives incorrect loop processing (gcc, g++)

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Tue Apr  2 00:26:07 2002
State-Changed-Why:
    Fixed for gcc 3.1.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=2512


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

* optimization/2512: optimization > -O gives incorrect loop processing (gcc, g++)
@ 2001-04-09  1:26 linux62i
  0 siblings, 0 replies; 2+ messages in thread
From: linux62i @ 2001-04-09  1:26 UTC (permalink / raw)
  To: gcc-gnats

>Number:         2512
>Category:       optimization
>Synopsis:       optimization > -O gives incorrect loop processing (gcc, g++)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 09 01:26:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Vladislav Belogroudov
>Release:        2.95.2
>Organization:
>Environment:
linux ~2.2.17
gcc 2.95.2 , 2.95.3 1991024-20000220
mandrake,debian... INTEL problem only (p133 processor in my case).
I tried DEC,SUN - works perfectly.
>Description:
when trying to optimize a program
with optimization level more than 1
gcc (g++) skips one iteration in 'for' loop

There is simple task. Two arrays 
int a[] = {0,1,2,3,4,5}; 
int b[] = {0,0,0,0,0,0}; // array to fill in
int i = 0; // counter

I am trying to put 1,2,3,4,5 from a[] into b[],
without zero, and into rest cell put 99.

g++ probe.cc
./a.out
5
1 2 3 4 5 99

g++ -02 probe.cc
./a.out
5
1 2 3 4 0 99

source file is attached





 
>How-To-Repeat:
see description
>Fix:
n/a
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="probe.cpp"
Content-Disposition: inline; filename="probe.cpp"

#include <iostream>

int main()
{

  int a[] = { 0, 1, 2, 3, 4, 5};
  int b[] = { 0, 0, 0, 0, 0, 0};
  int i = 0;

  for (i = 0; i < 5; i++) {
    b[i] = a[i+1];
  }  
  
  cerr << i << endl;

  b[i] = 99;

  for (i = 0; i < 6; i++) {
    cerr << b[i] << " ";
  }  
  
  cerr << endl;


  return 0;
}


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

end of thread, other threads:[~2002-04-02  8:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-02  0:26 optimization/2512: optimization > -O gives incorrect loop processing (gcc, g++) rth
  -- strict thread matches above, loose matches on Subject: below --
2001-04-09  1:26 linux62i

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).