public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/5800: gcc -O0 produces wrong code
@ 2002-03-01  3:46 Mikhail.Jabitski
  0 siblings, 0 replies; 2+ messages in thread
From: Mikhail.Jabitski @ 2002-03-01  3:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5800
>Category:       optimization
>Synopsis:       gcc -O0 produces wrong code
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 01 03:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     gcc
>Release:        3.0.4
>Organization:
>Environment:
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.0.4/configure
>Description:
gcc with optimization -O0 produces wrong code for the file comp.c:

#include <stdlib.h>

int main()
{
  int a[] = { 1, 1};
  printf("%i %i\n",a[0],a[1]);

  a[1] = a[0] && a[1];
  printf("%i %i\n",a[0],a[1]);

  return(1);
}

Compiled with: 
gcc -O0 comp.c

Program output:
1 1
1 0

Which is definitely wrong ("1 1" expected)
>How-To-Repeat:
Compile attached file with gcc -O0 comp.c and see results
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="comp.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="comp.c"

CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmludCBtYWluKCkKewogIGludCBhW10gPSB7IDEsIDF9Owog
IHByaW50ZigiJWkgJWlcbiIsYVswXSxhWzFdKTsKCiAgYVsxXSA9IGFbMF0gJiYgYVsxXTsKICBw
cmludGYoIiVpICVpXG4iLGFbMF0sYVsxXSk7CgogIHJldHVybigxKTsKfQo=


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

* Re: optimization/5800: gcc -O0 produces wrong code
@ 2002-03-02 19:50 rodrigc
  0 siblings, 0 replies; 2+ messages in thread
From: rodrigc @ 2002-03-02 19:50 UTC (permalink / raw)
  To: Mikhail.Jabitski, gcc-bugs, gcc-prs, nobody

Synopsis: gcc -O0 produces wrong code

State-Changed-From-To: open->closed
State-Changed-By: rodrigc
State-Changed-When: Sat Mar  2 19:50:16 2002
State-Changed-Why:
    I can reproduce your problem with gcc 3.0.4, but not with
    gcc version 3.1 20020217 (experimental).

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


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

end of thread, other threads:[~2002-03-03  3:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-01  3:46 optimization/5800: gcc -O0 produces wrong code Mikhail.Jabitski
2002-03-02 19:50 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).