public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/5264: Possible optimization bug at -O2 on HP-UX
@ 2002-01-03 7:06 luke
0 siblings, 0 replies; 4+ messages in thread
From: luke @ 2002-01-03 7:06 UTC (permalink / raw)
To: gcc-gnats
>Number: 5264
>Category: optimization
>Synopsis: Possible optimization bug at -O2 on HP-UX
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Jan 03 07:06:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Luke Tierney
>Release: gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
HP-UX bass B.11.00 A 9000/780 2007851940
>Description:
A possible optimization bug at -O2 on HP-UX found in building
R (Gnu S). Simplified program:
---------------(opttest.c)--------------------------------------------#include <stdio.h>
double x[] = { 1.0, 2.0}, y[] = { 1.0, 2.0 }, z[2];
main()
{
int i, i1, i2, n, n1, n2;
i1 = i2 = 0;
n = n1 = n2 = 2;
for (i = 0; i < n; i++) {
z[i] = x[i1] + y[i2];
i1 = (++i1 == n1) ? 0 : i1;
i2 = (++i2 == n2) ? 0 : i2;
}
printf("z[1] = %g\n", z[1]);
}
----------------------------------------------------------------------
Without optimization or with just -O it works fine:
tierney@bass [125]% gcc -o opttest opttest.c
ltierney@bass [126]% ./opttest
z[1] = 4ltierney@bass [127]% gcc -O -o opttest opttest.c
ltierney@bass [128]% ./opttest
z[1] = 4
But with -O2 it gets the wrong answer:
ltierney@bass [129]% gcc -O2 -o opttest opttest.c
ltierney@bass [130]% ./opttest
z[1] = 2
Please let me know if you need additional info.
>How-To-Repeat:
On HP-UX compare output of
gcc -O2 -o opttest opttest.c; ./opttest
gcc -O -o opttest opttest.c; ./opttest
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="opttest.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="opttest.c"
I2luY2x1ZGUgPHN0ZGlvLmg+Cgpkb3VibGUgeFtdID0geyAxLjAsIDIuMH0sIHlbXSA9IHsgMS4w
LCAyLjAgfSwgelsyXTsKCm1haW4oKQp7CiAgaW50IGksIGkxLCBpMiwgbiwgbjEsIG4yOwoKICBp
MSA9IGkyID0gMDsKICBuID0gbjEgPSBuMiA9IDI7CgogIGZvciAoaSA9IDA7IGkgPCBuOyBpKysp
IHsKICAgIHpbaV0gPSB4W2kxXSArIHlbaTJdOwogICAgaTEgPSAoKytpMSA9PSBuMSkgPyAwIDog
aTE7CiAgICBpMiA9ICgrK2kyID09IG4yKSA/IDAgOiBpMjsKICB9CiAgcHJpbnRmKCJ6WzFdID0g
JWdcbiIsIHpbMV0pOwp9Cg==
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: optimization/5264: Possible optimization bug at -O2 on HP-UX
@ 2002-01-04 10:07 rodrigc
0 siblings, 0 replies; 4+ messages in thread
From: rodrigc @ 2002-01-04 10:07 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, luke, nobody
Synopsis: Possible optimization bug at -O2 on HP-UX
State-Changed-From-To: feedback->closed
State-Changed-By: rodrigc
State-Changed-When: Fri Jan 4 10:07:41 2002
State-Changed-Why:
Submitter reports that problem does not occur in 2.95.3 or
3.0.3
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5264
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: optimization/5264: Possible optimization bug at -O2 on HP-UX
@ 2002-01-04 9:36 Luke Tierney
0 siblings, 0 replies; 4+ messages in thread
From: Luke Tierney @ 2002-01-04 9:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR optimization/5264; it has been noted by GNATS.
From: Luke Tierney <luke@stat.umn.edu>
To: rodrigc@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
luke@muskrat.stat.umn.edu, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: optimization/5264: Possible optimization bug at -O2 on HP-UX
Date: Fri, 4 Jan 2002 11:29:57 -0600
The patch applied to 2.95.2 does not help. But the example no longer
occurs in 2.95.3 or 3.0.3 (both without patching).
luke
On Thu, Jan 03, 2002 at 04:03:58PM -0000, rodrigc@gcc.gnu.org wrote:
> Synopsis: Possible optimization bug at -O2 on HP-UX
>
> State-Changed-From-To: open->feedback
> State-Changed-By: rodrigc
> State-Changed-When: Thu Jan 3 08:03:57 2002
> State-Changed-Why:
> Can you try applying the patch mentioned at the bottom of
> the message at:
> http://gcc.gnu.org/ml/gcc-patches/2001-12/msg02298.html
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5264
--
Luke Tierney
University of Minnesota Phone: 612-625-7843
School of Statistics Fax: 612-624-8868
313 Ford Hall, 224 Church St. S.E. email: luke@stat.umn.edu
Minneapolis, MN 55455 USA WWW: http://www.stat.umn.edu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: optimization/5264: Possible optimization bug at -O2 on HP-UX
@ 2002-01-03 8:04 rodrigc
0 siblings, 0 replies; 4+ messages in thread
From: rodrigc @ 2002-01-03 8:04 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, luke, nobody
Synopsis: Possible optimization bug at -O2 on HP-UX
State-Changed-From-To: open->feedback
State-Changed-By: rodrigc
State-Changed-When: Thu Jan 3 08:03:57 2002
State-Changed-Why:
Can you try applying the patch mentioned at the bottom of
the message at:
http://gcc.gnu.org/ml/gcc-patches/2001-12/msg02298.html
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5264
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-01-04 18:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-03 7:06 optimization/5264: Possible optimization bug at -O2 on HP-UX luke
2002-01-03 8:04 rodrigc
2002-01-04 9:36 Luke Tierney
2002-01-04 10:07 rodrigc
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).