<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - -fno-sanitize-trap=bounds still inserts trap"
href="https://bugs.llvm.org/show_bug.cgi?id=45633">45633</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-fno-sanitize-trap=bounds still inserts trap
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vitalybuka@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>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
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>