[llvm-bugs] [Bug 41657] New: clang integer sanitizer warns about int values returned by _mm_extract_epi16

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 29 14:36:22 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41657

            Bug ID: 41657
           Summary: clang integer sanitizer warns about int values
                    returned by _mm_extract_epi16
           Product: new-bugs
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: johannkoenig at google.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 21850
  --> https://bugs.llvm.org/attachment.cgi?id=21850&action=edit
minimized repro

Really, _mm_extract_epi16() should return int16_t and not int:
https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_extract_epi16&expand=2420

But because it returns int (even though the value it is extracting is 16 bits)
there are spurious warnings when the high bit is 1:

$ clang -fsanitize=integer test.c
$ ./a.out 
test.c:6:13: runtime error: implicit conversion from type 'int' of value 65535
(32-bit, signed) to type 'short' changed the value to -1 (16-bit, signed)
    #0 0x42b76c in main
(/usr/local/google/home/johannkoenig/build/a.out+0x42b76c)
    #1 0x7ff03078a2b0 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202b0)

-- 
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/20190429/1967689b/attachment-0001.html>


More information about the llvm-bugs mailing list