https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98692
--- Comment #11 from Will Schmidt <willschm at gcc dot gnu.org> --- (In reply to Mark Wielaard from comment #10) > (In reply to Will Schmidt from comment #9) > > (In reply to Segher Boessenkool from comment #5) > > > Have you tried a new valgrind? > > > > > > Either this is (or was) a known problem in valgrind, or it is related to > > > one. Cc:ing Aaron, he might know more (he wrote the GCC optimisations > > > that expose the problem). > > > > > > I've recreated against new (built out of upstream git) valgrind: > > with --track-origins=yes > > > > > > ==37507== > > argv[0]=./a.out > > ==37507== Use of uninitialised value of size 8 > > ==37507== at 0x10000618: main (pr9862.C:16) > > ==37507== Uninitialised value was created by a stack allocation > > ==37507== at 0x100007D4: isVariable(char*) (pr9862.C:5) > > Trying to get hold of a ppc64 setup. But could you try with --vgdb-error=0 > and then (in another window) gdb ./a.out and target remote | vgdb and > continue till you get the TRAP. Then disassamble so we can see the exact > instruction that generates the use of uninitialised value? Yes. so this traps on a ld instruction upon the return from the isVariable call. As seen below here: Window #1: ==79608== argv[0]=./a.out ==79608== Use of uninitialised value of size 8 ==79608== at 0x10000618: main (pr9862.C:16) ==79608== Uninitialised value was created by a stack allocation ==79608== at 0x100007D4: isVariable(char*) (pr9862.C:5) ==79608== ==79608== (action on error) vgdb me ... Window #2: (gdb) target remote | vgdb Remote debugging using | vgdb relaying data between gdb and process 79608 warning: remote target does not support file transfer, attempting to access files from local filesystem. Reading symbols from /lib64/ld64.so.2... (No debugging symbols found in /lib64/ld64.so.2) 0x0000000004001720 in ?? () from /lib64/ld64.so.2 (gdb) (gdb) set disassemble-next-line on (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. main (argc=<optimized out>, argv=0x1fff00e8a8) at pr9862.C:16 16 len = __builtin_strlen (argv[1]); => 0x0000000010000618 <main(int, char**)+56>: 08 00 7f e8 ld r3,8(r31) 0x000000001000061c <main(int, char**)+60>: a5 ff ff 4b bl 0x100005c0 <00000037.plt_call.strlen@@GLIBC_2.17> 0x0000000010000620 <main(int, char**)+64>: 18 00 41 e8 ld r2,24(r1) 0x0000000010000624 <main(int, char**)+68>: 00 00 00 60 nop 0x0000000010000628 <main(int, char**)+72>: 70 00 21 38 addi r1,r1,112 0x000000001000062c <main(int, char**)+76>: 50 81 62 90 stw r3,-32432(r2) (gdb) disas Dump of assembler code for function main(int, char**): 0x00000000100005e0 <+0>: lis r2,4098 0x00000000100005e4 <+4>: addi r2,r2,32512 0x00000000100005e8 <+8>: mflr r0 0x00000000100005ec <+12>: std r31,-8(r1) 0x00000000100005f0 <+16>: addis r3,r2,-2 0x00000000100005f4 <+20>: mr r31,r4 0x00000000100005f8 <+24>: addi r3,r3,-29882 0x00000000100005fc <+28>: std r0,16(r1) 0x0000000010000600 <+32>: stdu r1,-112(r1) 0x0000000010000604 <+36>: ld r4,0(r4) 0x0000000010000608 <+40>: bl 0x10000580 <00000037.plt_call.printf@@GLIBC_2.17> 0x000000001000060c <+44>: ld r2,24(r1) 0x0000000010000610 <+48>: ld r3,0(r31) 0x0000000010000614 <+52>: bl 0x100007c4 <isVariable(char*)+8> => 0x0000000010000618 <+56>: ld r3,8(r31) 0x000000001000061c <+60>: bl 0x100005c0 <00000037.plt_call.strlen@@GLIBC_2.17> 0x0000000010000620 <+64>: ld r2,24(r1) 0x0000000010000624 <+68>: nop 0x0000000010000628 <+72>: addi r1,r1,112 0x000000001000062c <+76>: stw r3,-32432(r2) 0x0000000010000630 <+80>: li r3,0 0x0000000010000634 <+84>: b 0x1000098c <_restgpr0_31> 0x0000000010000638 <+88>: .long 0x0 0x000000001000063c <+92>: .long 0x1000900 0x0000000010000640 <+96>: .long 0x180 End of assembler dump. (gdb) WIndow#1: