[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [valgrind] [Bug 330617] ppc false positive conditional jump depends on uninitialised value
From:       Hal Finkel <hfinkel () anl ! gov>
Date:       2014-02-10 18:50:04
Message-ID: bug-330617-17878-WTXeYehAiz () http ! bugs ! kde ! org/
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=330617

--- Comment #6 from Hal Finkel <hfinkel@anl.gov> ---
(In reply to comment #3)
> 
> > 2. I wrote a simple test in an attempt to reproduce the problem on x86:
> > valgrind does not report a false positive on the following code when
> > compiled with Clang trunk on x86 (even though the optimizers do the same
> > optimization that proves problematic to valgrind on ppc):
> 
> On x86_64 it generates a test instruction (AND, set the flags, throw
> away the result of the AND) which tests just the bits in question.
> That's why.
> 
> 0000000000400580 <foo>:
>   400580:       f6 07 e0                testb  $0xe0,(%rdi)
>   400583:       74 01                   je     400586 <foo+0x6>
>   400585:       c3                      retq   
>   400586:       bf 70 06 40 00          mov    $0x400670,%edi
>   40058b:       e9 c0 fe ff ff          jmpq   400450 <puts@plt>

When I compile the test on x86_64 using clang trunk r200705, I get this:

init:                                   # @init
    .cfi_startproc
# BB#0:                                 # %entry
    andb    $31, (%rdi)
    retq
...
foo:                                    # @foo
    .cfi_startproc
# BB#0:                                 # %entry
    movzbl    (%rdi), %eax
    cmpl    $31, %eax
    ja    .LBB1_1
# BB#2:                                 # %if.then
    movl    $.Lstr, %edi
    jmp    puts                    # TAILCALL
.LBB1_1:                                # %if.end
    retq

which, as best that I can tell, is really the same thing that clang is doing on
ppc (except that valgrind is fine with the x86_64 version).

-- 
You are receiving this mail because:
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic