public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/38588] New: strict-aliasing error
@ 2008-12-21 1:44 baisjing at yahoo dot com dot cn
2008-12-21 2:01 ` [Bug c/38588] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: baisjing at yahoo dot com dot cn @ 2008-12-21 1:44 UTC (permalink / raw)
To: gcc-bugs
Hi:
use gcc4.1.2 on x86_64/linux, for example:
main()
{
long long int a;
double b;
a=4607182418800017408;
b=*(double *)&a;
printf("%f\n",b);
}
if using -O0/-O1 optimization, the result is 1.000000;
but if using -O2/-O3 optimization,the result is 0.000000.
i have try to close -fno-strict-aliasing in -O2/-O3, the result will be same as
-O0/-O1.
so i think the strict-aliasing may have some bug!!!
--
Summary: strict-aliasing error
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: baisjing at yahoo dot com dot cn
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38588
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/38588] strict-aliasing error
2008-12-21 1:44 [Bug c/38588] New: strict-aliasing error baisjing at yahoo dot com dot cn
@ 2008-12-21 2:01 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-21 2:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-12-21 01:58 -------
No this is working as designed. GCC does warn about this case.
t.c:6: warning: dereferencing type-punned pointer will break strict-aliasing
rules
Now in 4.4.0 and above, the same result will happen at -O1 and -O2 because of
another optimization that allows for the compiler to remove the alias violation
in the IR.
*** This bug has been marked as a duplicate of 21920 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38588
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-21 2:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-21 1:44 [Bug c/38588] New: strict-aliasing error baisjing at yahoo dot com dot cn
2008-12-21 2:01 ` [Bug c/38588] " pinskia at gcc dot gnu dot org
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).