https://bugs.kde.org/show_bug.cgi?id=434193
            Bug ID: 434193
           Summary: GCC 9+ inlined strcmp causes "Conditional jump or move
                    depends on uninitialised value" report
           Product: valgrind
           Version: unspecified
          Platform: Debian testing
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: memcheck
          Assignee: jsew...@acm.org
          Reporter: m...@mcrowe.com
  Target Milestone: ---

Created attachment 136531
  --> https://bugs.kde.org/attachment.cgi?id=136531&action=edit
a.c

GCC 9.3.0 (OpenEmbedded, Ubuntu 20.04) and GCC 10.2.1 (Debian Bullseye) with
-O2 generate x86 and x86-64 code that causes memcheck (v2.16.1,
8b1961511c93962ea2a9b918af8e9c32e3c24d71) to report:

==4112219== Conditional jump or move depends on uninitialised value(s)
==4112219==    at 0x10906D: main (a.c:10)

STEPS TO REPRODUCE

 gcc -O3 a.c b.c
 valgrind ./a.out

(the files need to be separate so that GCC can't see the implementation of the
fill function when compiling main.)

The generated code contains:

    1067:       66 83 7c 24 0a 73       cmpw   $0x73,0xa(%rsp)
    106d:       75 e9                   jne    1058 <main+0x18>

where the cmpw is comparing a 16-bit word against 's', '\0' when only '\0' was
written to that part of the buffer.

This appears to be similar to bug 413642 and bug 420780.

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

Reply via email to