public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/4570: error reading bytes from double variable
@ 2001-11-20 17:56 aoliva
  0 siblings, 0 replies; 3+ messages in thread
From: aoliva @ 2001-11-20 17:56 UTC (permalink / raw)
  To: gcc-bugs, gcc-gnats, gcc-prs, nobody, philippe_ribet

Synopsis: error reading bytes from double variable

State-Changed-From-To: open->closed
State-Changed-By: aoliva
State-Changed-When: Sun Nov 25 08:45:58 2001
State-Changed-Why:
    Not a bug.  GCC is allowed by the aliasing rules in the C Standard to assume an int* can't possibly point to the same memory as e, that has type double.  If you depend on this behavior, use -fno-strict-aliasing, or access the storage using pointers to char, that can alias anything.

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


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

* Re: optimization/4570: error reading bytes from double variable
@ 2001-11-20 17:56 aoliva
  0 siblings, 0 replies; 3+ messages in thread
From: aoliva @ 2001-11-20 17:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/4570; it has been noted by GNATS.

From: aoliva@gcc.gnu.org
To: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
  nobody@gcc.gnu.org, philippe_ribet@hotmail.com
Cc:  
Subject: Re: optimization/4570: error reading bytes from double variable
Date: 25 Nov 2001 16:45:59 -0000

 Synopsis: error reading bytes from double variable
 
 State-Changed-From-To: open->closed
 State-Changed-By: aoliva
 State-Changed-When: Sun Nov 25 08:45:58 2001
 State-Changed-Why:
     Not a bug.  GCC is allowed by the aliasing rules in the C Standard to assume an int* can't possibly point to the same memory as e, that has type double.  If you depend on this behavior, use -fno-strict-aliasing, or access the storage using pointers to char, that can alias anything.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4570&database=gcc


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

* optimization/4570: error reading bytes from double variable
@ 2001-10-15  2:06 philippe_ribet
  0 siblings, 0 replies; 3+ messages in thread
From: philippe_ribet @ 2001-10-15  2:06 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4570
>Category:       optimization
>Synopsis:       error reading bytes from double variable
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 15 02:06:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     philippe_ribet@hotmail.com
>Release:        gcc version 3.0.2 20010922
>Organization:
>Environment:
Athlon processor
>Description:
gcc-3.0.1 give good result up to -O2, bad one with -O3
gcc-3.0.2 give good result without optimization, bad with -O2
May be relative to optimization recently moved from -O3 to -O2.

main()
{
  double e=0;
  e=(double)(0.5);
  printf("e=%08x%08x\n",*((int *)(((char *)(&e)))),*((int *)(((char *)(&e))+4)));
}

>How-To-Repeat:

>Fix:

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


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

end of thread, other threads:[~2001-11-25 16:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-20 17:56 optimization/4570: error reading bytes from double variable aoliva
  -- strict thread matches above, loose matches on Subject: below --
2001-11-20 17:56 aoliva
2001-10-15  2:06 philippe_ribet

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