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: unassig...@gcc.gnu.org
        ReportedBy: marcel.k...@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.

Reply via email to