|
From: Carl E. L. <ce...@us...> - 2017-04-25 17:36:29
|
Valgrind developers:
The GCC 7 compiler for power has a new optimization that is tripping up
Valgrind. Basically they are taking the strcmp() function and doing
some inlining of the code. Here is a snipit of the generated code
return strcmp(str1, str2);
100004bc: 28 4c 20 7d ldbrx r9,0,r9
100004c0: 28 54 40 7d ldbrx r10,0,r10
100004c4: 51 48 6a 7c subf. r3,r10,r9
100004c8: 1c 00 82 40 bne 100004e4 <main+0x84>
100004cc: f8 1b 2a 7d cmpb r10,r9,r3
100004d0: 00 00 aa 2f cmpdi cr7,r10,0
100004d4: 38 00 9e 41 beq cr7,1000050c <main+0xac>
The inlined code has two load double word instructions (ldbrx inst) that
are partially uninitialized. Following the two double word loads we do a
subf. instruction to subtract the values and set the condition code.
Then we get to the branch instruction (bne) and valgrind flags the
error:
==23948== Conditional jump or move depends on uninitialised value(s)
==23948== at 0x100004C8: main (bug80497.c:9)
==23948==
==23948== Syscall param exit_group(status) contains uninitialised
byte(s)
==23948== at 0x41BDEA4: _Exit (_exit.c:31)
The code has some cmpb instructions to make sure they don't actually use
the uninitialized bytes but that doesn't really help Valgrind. I was
thinking of trying to create a rule to ignore the error but not sure I
can do this as it is inlined code. It isn't like trying to ignore
errors from a function. I have looked a little at the suppression rules
and from what I know of them it isn't clear how to write one for this
case were inlined code could show up anywhere.
Wondering if anyone has thoughts on how to asddress fixing the issue or
how to suppress the issue?
|