https://bugs.kde.org/show_bug.cgi?id=386945
--- Comment #50 from Mark Wielaard <m...@klomp.org> ---
Created attachment 116688
  --> https://bugs.kde.org/attachment.cgi?id=116688&action=edit
aligned and unaligned ldbrx, lxvd2x and lxvb16x testcases

These are the assembly files generated by gcc8 with the new strcmp inlined
code.

The aligned code shows a short string being compared where the instruction is
split up in multiple loads (by the frontend!), one of which memcheck will think
it completely past addressable memory.

The unaligned code shows the strcmp using one of these double word or vector
instructions on an unaligned memory address, which also confuses memcheck.

The following is what current valgrind produces on a power9 ppc64le setup:

# for a in aligned unaligned; do for i in ldbrx lxvd2x lxvb16x; do echo $a-$i;
gcc -o $a-$i $a-$i.s; valgrind -q ./$a-$i > /dev/null; done; done
aligned-ldbrx
==7890== Invalid read of size 4
==7890==    at 0x1000061C: main (in /root/v-ppc64-stcmp/aligned-ldbrx)
==7890==  Address 0x42e0044 is 0 bytes after a block of size 4 alloc'd
==7890==    at 0x408420C: malloc (vg_replace_malloc.c:299)
==7890==    by 0x100005A7: main (in /root/v-ppc64-stcmp/aligned-ldbrx)
==7890== 
aligned-lxvd2x
==7895== Invalid read of size 8
==7895==    at 0x10000628: main (in /root/v-ppc64-stcmp/aligned-lxvd2x)
==7895==  Address 0x42e0048 is 4 bytes after a block of size 4 alloc'd
==7895==    at 0x408420C: malloc (vg_replace_malloc.c:299)
==7895==    by 0x100005A7: main (in /root/v-ppc64-stcmp/aligned-lxvd2x)
==7895== 
==7895== Use of uninitialised value of size 8
==7895==    at 0x4050794: _vgnU_freeres (vg_preloaded.c:68)
==7895==    by 0x4114A03: __run_exit_handlers (in
/usr/lib64/power9/libc-2.28.so)
==7895==    by 0x4114A97: exit (in /usr/lib64/power9/libc-2.28.so)
==7895==    by 0x40F417F: (below main) (in /usr/lib64/power9/libc-2.28.so)
==7895== 
==7895== Use of uninitialised value of size 8
==7895==    at 0x40505C4: ??? (in
/usr/lib64/valgrind/vgpreload_core-ppc64le-linux.so)
==7895==    by 0x4114A03: __run_exit_handlers (in
/usr/lib64/power9/libc-2.28.so)
==7895==    by 0x4114A97: exit (in /usr/lib64/power9/libc-2.28.so)
==7895==    by 0x40F417F: (below main) (in /usr/lib64/power9/libc-2.28.so)
==7895== 
aligned-lxvb16x
==7900== Invalid read of size 1
==7900==    at 0x10000628: main (in /root/v-ppc64-stcmp/aligned-lxvb16x)
==7900==  Address 0x42e0044 is 0 bytes after a block of size 4 alloc'd
==7900==    at 0x408420C: malloc (vg_replace_malloc.c:299)
==7900==    by 0x100005A7: main (in /root/v-ppc64-stcmp/aligned-lxvb16x)
==7900== 
unaligned-ldbrx
==7905== Invalid read of size 4
==7905==    at 0x10000630: main (in /root/v-ppc64-stcmp/unaligned-ldbrx)
==7905==  Address 0x42e0045 is 0 bytes after a block of size 5 alloc'd
==7905==    at 0x408420C: malloc (vg_replace_malloc.c:299)
==7905==    by 0x100005A7: main (in /root/v-ppc64-stcmp/unaligned-ldbrx)
==7905== 
unaligned-lxvd2x
==7910== Invalid read of size 8
==7910==    at 0x10000630: main (in /root/v-ppc64-stcmp/unaligned-lxvd2x)
==7910==  Address 0x42e0041 is 1 bytes inside a block of size 5 alloc'd
==7910==    at 0x408420C: malloc (vg_replace_malloc.c:299)
==7910==    by 0x100005A7: main (in /root/v-ppc64-stcmp/unaligned-lxvd2x)
==7910== 
unaligned-lxvb16x
==7915== Invalid read of size 1
==7915==    at 0x10000630: main (in /root/v-ppc64-stcmp/unaligned-lxvb16x)
==7915==  Address 0x42e0045 is 0 bytes after a block of size 5 alloc'd
==7915==    at 0x408420C: malloc (vg_replace_malloc.c:299)
==7915==    by 0x100005A7: main (in /root/v-ppc64-stcmp/unaligned-lxvb16x)
==7915==

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

Reply via email to