[Bug sanitizer/61095] miscompile: tsan is broken in gcc trunk, works in 4.9

kcc at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 7 12:55:00 GMT 2014


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

Kostya Serebryany <kcc at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|x86_64-*-*                  |
           Priority|P3                          |P1
   Target Milestone|4.10.0                      |---
            Summary|[4.10 Regression] tsan is   |miscompile: tsan is broken
                   |broken in gcc trunk, works  |in gcc trunk, works in 4.9
                   |in 4.9                      |

--- Comment #2 from Kostya Serebryany <kcc at gcc dot gnu.org> ---
fresh gcc optimizes away a piece of code. minimal repro:

int FOO(unsigned long addr) {
    unsigned long *p = (unsigned long*)((addr & 0xffff83fffffffff8UL) * 4);
    unsigned long xxx = (unsigned long)(p + 1);
    return xxx >= 0x3c000000000UL;
}


gcc 4.9: 
/usr/local/gcc-4.9.0/bin/gcc -S z.c -O2  -o -  | grep -A 10 FOO:
FOO:
.LFB0:
        .cfi_startproc
        movabsq $-136339441844232, %rax
        andq    %rax, %rdi
        movabsq $4123168604159, %rax
        leaq    8(,%rdi,4), %rdx
        cmpq    %rax, %rdx
        seta    %al
        movzbl  %al, %eax
        ret


trunk: 
../gcc-inst/bin/gcc -S z.c -O2  -o -  | grep -A 10 FOO:
FOO:
.LFB0:
        .cfi_startproc
        xorl    %eax, %eax
        ret



More information about the Gcc-bugs mailing list