[llvm-bugs] [Bug 40063] New: memcmp with constant string arguments produces wrong result

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 18 01:17:31 PST 2018


            Bug ID: 40063
           Summary: memcmp with constant string arguments produces wrong
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bruno at clisp.org
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Created attachment 21244
  --> https://bugs.llvm.org/attachment.cgi?id=21244&action=edit
Test case

A memcmp() call with constant arguments is apparently inlined by clang and
produces a wrong result.

How to reproduce:
$ cc foo.c
$ nm a.out | grep memcmp
$ ./a.out
Expected output: A negative number.
Actual output: 1

OS: FreeBSD 12.0 on x86_64

clang version:
$ cc --version
FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181218/41dd8a99/attachment.html>

More information about the llvm-bugs mailing list