public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53416] New: 4.7.0 Wrong code when optimising loop involving _rdrand32_step
@ 2012-05-19 17:15 marcel.kyas@fu-berlin.de
  2012-05-20 17:48 ` [Bug target/53416] " hjl.tools at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: marcel.kyas@fu-berlin.de @ 2012-05-19 17:15 UTC (permalink / raw)
  To: gcc-bugs

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.


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

* [Bug target/53416] Wrong code when optimising loop involving _rdrand32_step
  2012-05-19 17:15 [Bug c/53416] New: 4.7.0 Wrong code when optimising loop involving _rdrand32_step marcel.kyas@fu-berlin.de
@ 2012-05-20 17:48 ` hjl.tools at gmail dot com
  2012-05-20 18:22 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2012-05-20 17:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53416

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2012-05/msg01338.htm
                   |                            |l

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2012-05-20 17:05:40 UTC ---
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01338.html


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

* [Bug target/53416] Wrong code when optimising loop involving _rdrand32_step
  2012-05-19 17:15 [Bug c/53416] New: 4.7.0 Wrong code when optimising loop involving _rdrand32_step marcel.kyas@fu-berlin.de
  2012-05-20 17:48 ` [Bug target/53416] " hjl.tools at gmail dot com
@ 2012-05-20 18:22 ` hjl.tools at gmail dot com
  2012-05-21 12:41 ` hjl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2012-05-20 18:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53416

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-05-20
   Target Milestone|---                         |4.6.4
            Summary|4.7.0 Wrong code when       |Wrong code when optimising
                   |optimising loop involving   |loop involving
                   |_rdrand32_step              |_rdrand32_step
     Ever Confirmed|0                           |1


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

* [Bug target/53416] Wrong code when optimising loop involving _rdrand32_step
  2012-05-19 17:15 [Bug c/53416] New: 4.7.0 Wrong code when optimising loop involving _rdrand32_step marcel.kyas@fu-berlin.de
  2012-05-20 17:48 ` [Bug target/53416] " hjl.tools at gmail dot com
  2012-05-20 18:22 ` hjl.tools at gmail dot com
@ 2012-05-21 12:41 ` hjl at gcc dot gnu.org
  2012-05-21 13:07 ` hjl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl at gcc dot gnu.org @ 2012-05-21 12:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53416

--- Comment #2 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> 2012-05-21 12:32:04 UTC ---
Author: hjl
Date: Mon May 21 12:31:45 2012
New Revision: 187709

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187709
Log:
Use unspec_volatile on rdrand<mode>_1

gcc/

    PR target/53416
    * config/i386/i386.md (UNSPEC_RDRAND): Renamed to ...
    (UNSPECV_RDRAND): This.
    (rdrand<mode>_1): Updated.

gcc/testsuite/

    PR target/53416
    * gcc.target/i386/pr53416.c: New file.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr53416.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.md
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/53416] Wrong code when optimising loop involving _rdrand32_step
  2012-05-19 17:15 [Bug c/53416] New: 4.7.0 Wrong code when optimising loop involving _rdrand32_step marcel.kyas@fu-berlin.de
                   ` (2 preceding siblings ...)
  2012-05-21 12:41 ` hjl at gcc dot gnu.org
@ 2012-05-21 13:07 ` hjl at gcc dot gnu.org
  2012-05-21 13:09 ` hjl at gcc dot gnu.org
  2012-05-21 13:10 ` hjl.tools at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: hjl at gcc dot gnu.org @ 2012-05-21 13:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53416

--- Comment #3 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> 2012-05-21 12:59:58 UTC ---
Author: hjl
Date: Mon May 21 12:59:53 2012
New Revision: 187712

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187712
Log:
Use unspec_volatile on rdrand<mode>_1

gcc/

    Backport from mainline
    PR target/53416
    * config/i386/i386.md (UNSPEC_RDRAND): Renamed to ...
    (UNSPECV_RDRAND): This.
    (rdrand<mode>_1): Updated.


gcc/testsuite/

    Backport from mainline
    PR target/53416
    * gcc.target/i386/pr53416.c: New file.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/pr53416.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/config/i386/i386.md
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug target/53416] Wrong code when optimising loop involving _rdrand32_step
  2012-05-19 17:15 [Bug c/53416] New: 4.7.0 Wrong code when optimising loop involving _rdrand32_step marcel.kyas@fu-berlin.de
                   ` (3 preceding siblings ...)
  2012-05-21 13:07 ` hjl at gcc dot gnu.org
@ 2012-05-21 13:09 ` hjl at gcc dot gnu.org
  2012-05-21 13:10 ` hjl.tools at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: hjl at gcc dot gnu.org @ 2012-05-21 13:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53416

--- Comment #4 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> 2012-05-21 13:07:16 UTC ---
Author: hjl
Date: Mon May 21 13:07:11 2012
New Revision: 187713

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187713
Log:
Use unspec_volatile on rdrand<mode>_1

gcc/

    Backport from mainline
    PR target/53416
    * config/i386/i386.md (UNSPEC_RDRAND): Renamed to ...
    (UNSPECV_RDRAND): This.
    (rdrand<mode>_1): Updated.


gcc/testsuite/

    Backport from mainline
    PR target/53416
    * gcc.target/i386/pr53416.c: New file.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.target/i386/pr53416.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/config/i386/i386.md
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug target/53416] Wrong code when optimising loop involving _rdrand32_step
  2012-05-19 17:15 [Bug c/53416] New: 4.7.0 Wrong code when optimising loop involving _rdrand32_step marcel.kyas@fu-berlin.de
                   ` (4 preceding siblings ...)
  2012-05-21 13:09 ` hjl at gcc dot gnu.org
@ 2012-05-21 13:10 ` hjl.tools at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2012-05-21 13:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53416

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> 2012-05-21 13:08:53 UTC ---
Fixed.


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

end of thread, other threads:[~2012-05-21 13:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-19 17:15 [Bug c/53416] New: 4.7.0 Wrong code when optimising loop involving _rdrand32_step marcel.kyas@fu-berlin.de
2012-05-20 17:48 ` [Bug target/53416] " hjl.tools at gmail dot com
2012-05-20 18:22 ` hjl.tools at gmail dot com
2012-05-21 12:41 ` hjl at gcc dot gnu.org
2012-05-21 13:07 ` hjl at gcc dot gnu.org
2012-05-21 13:09 ` hjl at gcc dot gnu.org
2012-05-21 13:10 ` hjl.tools at gmail dot com

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