[llvm-bugs] [Bug 24561] New: [msan] False positive on icmp sgt (trunc %x), -1
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Aug 24 15:11:27 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24561
Bug ID: 24561
Summary: [msan] False positive on icmp sgt (trunc %x), -1
Product: compiler-rt
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: compiler-rt
Assignee: unassignedbugs at nondot.org
Reporter: eugeni.stepanov at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
$ cat 1.cc
#include <stdio.h>
struct A {
bool c1 : 7;
bool c8 : 1;
bool c9 : 1;
A();
};
__attribute__((noinline)) A::A() : c8(false) {}
int main() {
A* a = new A();
if (a->c8)
printf("zz\n");
return 0;
}
$ clang++ 1.cc -O2 -fsanitize=memory && ./a.out
WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x7f8dd5a8712c in main 1.cc:15:7
...
Bitcode for the "if" instruction:
%10 = bitcast i8* %call to i16*
%bf.load = load i16, i16* %10, align 1
%11 = trunc i16 %bf.load to i8
%bf.cast = icmp sgt i8 %11, -1
br i1 %bf.cast, label %if.end, label %if.then
MSan instrumentation:
%bf.load = load i16, i16* %1, align 1
%4 = ptrtoint i16* %1 to i64
%5 = and i64 %4, -70368744177665
%6 = inttoptr i64 %5 to i16*
%_msld = load i16, i16* %6, align 1
%_msprop = trunc i16 %_msld to i8
%7 = trunc i16 %bf.load to i8
>>> BUG
%8 = trunc i8 %_msprop to i1
%bf.cast = icmp sgt i8 %7, -1
<<<
%_mscmp2 = icmp ne i1 %8, false
br i1 %_mscmp2, label %9, label %10, !prof !1
--
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/20150824/2e88ed2f/attachment-0001.html>
More information about the llvm-bugs
mailing list