[llvm-bugs] [Bug 52421] New: Inconsistent UndefinedSanitizer report
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Nov 5 09:20:20 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52421
Bug ID: 52421
Summary: Inconsistent UndefinedSanitizer report
Product: clang
Version: 13.0
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C
Assignee: unassignedclangbugs at nondot.org
Reporter: shaohua.li at inf.ethz.ch
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Hi there,
I found that the UndefinedSanitizer would report runtime error on the follow
code:
$cat a.c
int main() {
double x = 2147483649;
int y = x;
}
$
$clang-13 -fsanitize=undefined a.c ; ./a.out
a.c:3:10: runtime error: 2.14748e+09 is outside the range of representable
values of type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior a.c:3:10
However, if I changed the 'double' type to 'long', the error report went away.
$cat a.c
int main() {
long x = 2147483649;
int y = x;
}
$
$clang-13 -fsanitize=undefined a.c ; ./a.out
$
--
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/20211105/25e00139/attachment.html>
More information about the llvm-bugs
mailing list