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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
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._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs