[Bug middle-end/56098] conditional write through volatile pointer produces unintended read

mikpe at it dot uu.se gcc-bugzilla@gcc.gnu.org
Fri Jan 25 08:43:00 GMT 2013


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

Mikael Pettersson <mikpe at it dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu.se

--- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> 2013-01-25 08:42:56 UTC ---
gcc 3.3.6 to 4.2.4 generate:

problem:
.LFB2:
        movq    ptr(%rip), %rax
        testl   %edi, %edi
        movl    $1, (%rax)
        je      .L4
        movl    $2, (%rax)
.L4:
        rep ; ret

which looks Ok to me.  From 4.3.6 up to 4.7.2 we get the broken code Werner
showed.  3.2.3 generates different broken code:

problem:
.LFB1:
        xorl    %eax, %eax
        movq    ptr(%rip), %rdx
        testl   %edi, %edi
        setne   %al
        movl    $1, (%rdx)
        incl    %eax
        movl    %eax, (%rdx)
        ret



More information about the Gcc-bugs mailing list