public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/9902: optimization level -O2/3 doesn't work correctly.
@ 2003-03-14 15:48 ebotcazou
  0 siblings, 0 replies; 4+ messages in thread
From: ebotcazou @ 2003-03-14 15:48 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, gennadi.f, nobody

Synopsis: optimization level -O2/3 doesn't work correctly.

State-Changed-From-To: open->closed
State-Changed-By: ebotcazou
State-Changed-When: Fri Mar 14 15:48:30 2003
State-Changed-Why:
    Not a bug. Your code breaks the ISO C aliasing rules. GCC
    automatically turns on -fstrict-aliasing at -O2 so you need
    to fix your code or compile it with -fno-strict-aliasing.

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


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

* Re: c/9902: optimization level -O2/3 doesn't work correctly.
@ 2003-03-02 17:03 paolo
  0 siblings, 0 replies; 4+ messages in thread
From: paolo @ 2003-03-02 17:03 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, gennadi.f, nobody

Synopsis: optimization level -O2/3 doesn't work correctly.

State-Changed-From-To: closed->open
State-Changed-By: paolo
State-Changed-When: Sun Mar  2 17:03:38 2003
State-Changed-Why:
    Closed as a duplicate by mistake.

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


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

* Re: c/9902: optimization level -O2/3 doesn't work correctly.
@ 2003-03-02 16:43 paolo
  0 siblings, 0 replies; 4+ messages in thread
From: paolo @ 2003-03-02 16:43 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, gennadi.f, nobody

Synopsis: optimization level -O2/3 doesn't work correctly.

State-Changed-From-To: open->closed
State-Changed-By: paolo
State-Changed-When: Sun Mar  2 16:43:26 2003
State-Changed-Why:
    Exact duplicate of c/9901.

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


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

* c/9902: optimization level -O2/3 doesn't work correctly.
@ 2003-03-02 16:26 gennadi.f
  0 siblings, 0 replies; 4+ messages in thread
From: gennadi.f @ 2003-03-02 16:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9902
>Category:       c
>Synopsis:       optimization level -O2/3 doesn't work correctly.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 02 16:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     gennadi.f@corigin.com
>Release:        3.2.2
>Organization:
>Environment:
sunOS 2.8 sparc
>Description:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main() {
 char *page,*p;

 page=calloc(1,4);
 page+=4;
 p=page;
 if (page) { // if we change "page" here to "1", the result will be correct
     *((char **)page-1)=page;    // save the address in its previous 4 bytes.
     (*((char ***)page-1))++;    // add 4 to the saved address.
 }
 page=*((char **)page-1);        //"page" should be assigned to the new value.
 printf("page=%08X p=%08X\n",page,p); // with the optimization level -O2/3, the value of page i
s not changed.
 return 0;
}
>How-To-Repeat:
compile with and without O3/O2 options. 
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-03-14 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-14 15:48 c/9902: optimization level -O2/3 doesn't work correctly ebotcazou
  -- strict thread matches above, loose matches on Subject: below --
2003-03-02 17:03 paolo
2003-03-02 16:43 paolo
2003-03-02 16:26 gennadi.f

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