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

Mark Wielaard <m...@klomp.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m...@klomp.org

--- Comment #40 from Mark Wielaard <m...@klomp.org> ---
Created attachment 114334
  --> https://bugs.kde.org/attachment.cgi?id=114334&action=edit
simple z13 executable with strlen inlined

Here is a hopefully simpler reproducer for the following program compiled with
GCC 8.2.1 with gcc -march=z13 -mtune=z14 -Wall -g -O2 -o t t.c

# cat t.c 
#include <string.h>
#include <stdlib.h>

int
main (int argc, char **argv)
{
  int status = argc > 1;
  if (status)
    {
      char *str = strdup (argv[1]);
      int len1 = strlen (argv[1]);
      int len2 = strlen (str);
      status &= len1 < 8 && len2 > 4;
      free (str);
    }

  exit (!status);
}

# gcc -march=z13 -mtune=z14 -Wall -g -O2 -o t t.c
# ./vg-in-place -q ./t hello
==6001== Conditional jump or move depends on uninitialised value(s)
==6001==    at 0x10005E8: main (t.c:12)
==6001== 
==6001== Conditional jump or move depends on uninitialised value(s)
==6001==    at 0x1000610: main (t.c:12)
==6001== 
==6001== Conditional jump or move depends on uninitialised value(s)
==6001==    at 0x1000614: main (t.c:12)
==6001== 
==6001== Conditional jump or move depends on uninitialised value(s)
==6001==    at 0x100062C: main (t.c:13)
==6001== 

# ./vg-in-place --vgdb-error=0 ./t hello

# gdb ./t
0x00000000040013c0 in _start () from /lib/ld64.so.1
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00000000010005e8 in main (argc=<optimized out>, argv=0x1ffefffcb8) at t.c:12
12            int len2 = strlen (str);
(gdb) disassemble 
Dump of assembler code for function main:
   0x0000000001000528 <+0>:     stmg    %r12,%r15,96(%r15)
   0x000000000100052e <+6>:     lay     %r15,-160(%r15)
   0x0000000001000534 <+12>:    cijh    %r2,1,0x1000550 <main+40>
   0x000000000100053a <+18>:    lhi     %r12,0
   0x000000000100053e <+22>:    lr      %r2,%r12
   0x0000000001000540 <+24>:    xilf    %r2,1
   0x0000000001000546 <+30>:    lgfr    %r2,%r2
   0x000000000100054a <+34>:    brasl   %r14,0x10004c8 <exit@plt>
   0x0000000001000550 <+40>:    lgr     %r12,%r3
   0x0000000001000554 <+44>:    lg      %r2,8(%r3)
   0x000000000100055a <+50>:    brasl   %r14,0x1000508 <__strdup@plt>
   0x0000000001000560 <+56>:    lg      %r3,8(%r12)
   0x0000000001000566 <+62>:    lghi    %r4,0
   0x000000000100056a <+66>:    risbg   %r1,%r3,60,191,0
   0x0000000001000570 <+72>:    je      0x100059a <main+114>
   0x0000000001000574 <+76>:    lghi    %r5,15
   0x0000000001000578 <+80>:    sgr     %r5,%r1
   0x000000000100057c <+84>:    vll     %v0,%r5,0(%r3)
   0x0000000001000582 <+90>:    aghi    %r4,16
   0x0000000001000586 <+94>:    vfenezbs        %v0,%v0,%v0
   0x000000000100058c <+100>:   je      0x10005a2 <main+122>
   0x0000000001000590 <+104>:   vl      %v0,0(%r4,%r3)
   0x0000000001000596 <+110>:   j       0x1000582 <main+90>
   0x000000000100059a <+114>:   lghi    %r5,15
   0x000000000100059e <+118>:   j       0x1000590 <main+104>
   0x00000000010005a2 <+122>:   vlgvb   %r1,%v0,7
   0x00000000010005a8 <+128>:   llgcr   %r1,%r1
   0x00000000010005ac <+132>:   cgr     %r1,%r5
   0x00000000010005b0 <+136>:   la      %r5,1(%r5)
   0x00000000010005b4 <+140>:   locgrh  %r4,%r5
   0x00000000010005b8 <+144>:   jh      0x100059a <main+114>
   0x00000000010005bc <+148>:   lay     %r5,-16(%r4,%r1)
   0x00000000010005c2 <+154>:   lghi    %r4,0
   0x00000000010005c6 <+158>:   risbg   %r1,%r2,60,191,0
   0x00000000010005cc <+164>:   je      0x10005f6 <main+206>
   0x00000000010005d0 <+168>:   lghi    %r3,15
   0x00000000010005d4 <+172>:   sgr     %r3,%r1
   0x00000000010005d8 <+176>:   vll     %v0,%r3,0(%r2)
   0x00000000010005de <+182>:   aghi    %r4,16
   0x00000000010005e2 <+186>:   vfenezbs        %v0,%v0,%v0
=> 0x00000000010005e8 <+192>:   je      0x10005fe <main+214>
   0x00000000010005ec <+196>:   vl      %v0,0(%r4,%r2)
   0x00000000010005f2 <+202>:   j       0x10005de <main+182>
   0x00000000010005f6 <+206>:   lghi    %r3,15
   0x00000000010005fa <+210>:   j       0x10005ec <main+196>
   0x00000000010005fe <+214>:   vlgvb   %r1,%v0,7
   0x0000000001000604 <+220>:   llgcr   %r1,%r1
   0x0000000001000608 <+224>:   cgr     %r1,%r3
   0x000000000100060c <+228>:   la      %r3,1(%r3)
   0x0000000001000610 <+232>:   locgrh  %r4,%r3
   0x0000000001000614 <+236>:   jh      0x10005f6 <main+206>
   0x0000000001000618 <+240>:   lay     %r1,-16(%r4,%r1)
   0x000000000100061e <+246>:   cijh    %r5,7,0x100063c <main+276>
   0x0000000001000624 <+252>:   chi     %r1,4
   0x0000000001000628 <+256>:   lhi     %r12,0
   0x000000000100062c <+260>:   lochih  %r12,1
   0x0000000001000632 <+266>:   brasl   %r14,0x10004a8 <free@plt>
   0x0000000001000638 <+272>:   j       0x100053e <main+22>
   0x000000000100063c <+276>:   lhi     %r12,0
   0x0000000001000640 <+280>:   j       0x1000632 <main+266>
End of assembler dump.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to