|
From: Patrick J. L. <lop...@gm...> - 2017-04-25 18:19:34
|
This sort of code is supposed to be handled by "--partial-loads-ok=yes". (Which should be made the default, in my opinion.) If that does not work, it is a bug in the partial-loads-ok support. - Pat On Tue, Apr 25, 2017 at 10:36 AM, Carl E. Love <ce...@us...> wrote: > 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? > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers |