This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/53416] New: 4.7.0 Wrong code when optimising loop involving _rdrand32_step
- From: "marcel dot kyas at fu-berlin dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 19 May 2012 14:56:12 +0000
- Subject: [Bug c/53416] New: 4.7.0 Wrong code when optimising loop involving _rdrand32_step
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53416
Bug #: 53416
Summary: 4.7.0 Wrong code when optimising loop involving
_rdrand32_step
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: marcel.kyas@fu-berlin.de
Created attachment 27440
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27440
Reduced test case
The attached file prints different output depending whether it is compiled with
-O0, -O1 or -O2 on gcc-Version 4.7.0 20120507 (Red Hat 4.7.0-5) (GCC).
When the file is built with gcc -std=c99 -mrdrnd -O0 rngtest.i, it prints four
different random numbers. If it is built with gcc -std=c99 -mrdrnd -O1
rngtest.i, it prints the same number four times. If it is built with gcc
-std=c99 -mrdrnd -O2 rngtest.i, it prints the random number four times and
prints the random number as the result of the call to _rdrand32_step. The last
one is especially surprising, because _rdrand32_step should only return 0 or 1.