http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59409

--- Comment #17 from H.J. Lu <hjl.tools at gmail dot com> ---
Perl_my_bcopy (len=31, to=0xf7fd801d "\021q", from=0x8023f0 "\264\005q")
is miscompiled when inlined:

Old value = 19935280
New value = 808464432
Perl_my_bcopy (len=-1, to=0xf7fd803c "\260Vx", from=<optimized out>) at
util.c:1559
1559        while (len--)

The last write is to 4-bytes at 0xf7fd803b:

  442dd7:       83 fe 0b                cmp    $0xb,%esi
  442dda:       67 44 88 42 0b          mov    %r8b,0xb(%edx)
  442ddf:       74 27                   je     442e08 <Perl_pp_rv2av+0x898>

(gdb) p/x $edx
$300 = 0xf7fd8030
(gdb) p/x $edx + 0xb
$301 = 0xf7fd803b
(gdb) 

But the last byte should be written at 0xf7fd801d + 30 == 0xf7fd803b.
There are 3 byte overflow for write.  I will see if I can write a
testcase.

Reply via email to