[llvm-bugs] [Bug 45633] New: -fno-sanitize-trap=bounds still inserts trap
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Apr 21 14:19:21 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45633
Bug ID: 45633
Summary: -fno-sanitize-trap=bounds still inserts trap
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: vitalybuka at google.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Code is UB, however, some diagnostics is expected, instead of SIGILL.
cat test.cpp
char a;
int b() {
char c = *(&a + a);
return c;
}
clang++ -fsanitize=bounds -fno-sanitize-trap=all -S -emit-llvm test.cpp -o -
Result:
define dso_local i32 @_Z1bv() #0 {
entry:
%c = alloca i8, align 1
%0 = load i8, i8* @a, align 1
%conv = sext i8 %0 to i32
%idx.ext = sext i32 %conv to i64
%add.ptr.offs = add i64 %idx.ext, 0
%1 = add i64 0, %add.ptr.offs
%add.ptr = getelementptr inbounds i8, i8* @a, i64 %idx.ext
%2 = sub i64 1, %1
%3 = icmp ult i64 1, %1
%4 = icmp ult i64 %2, 1
%5 = or i1 %3, %4
br i1 %5, label %trap, label %6
6: ; preds = %entry
%7 = load i8, i8* %add.ptr, align 1
store i8 %7, i8* %c, align 1
%8 = load i8, i8* %c, align 1
%conv1 = sext i8 %8 to i32
ret i32 %conv1
trap: ; preds = %entry
call void @llvm.trap() #2
unreachable
}
--
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/20200421/14373e7f/attachment.html>
More information about the llvm-bugs
mailing list