https://bugs.llvm.org/show_bug.cgi?id=52270
Bug ID: 52270
Summary: UBSan is inconsistent about erroring on dead code in
ternary operator branches
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedb...@nondot.org
Reporter: reg...@cs.utah.edu
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org
https://gcc.godbolt.org/z/WxKjWMo47
in this example program (supplied by Pascal Cuoq), UBSan should either error in
both cases, or in neither of them (I would argue that it should not error in
either case, but ymmv):
void f(int a) {
a ? 0 : 0x7fffffff + 1;
}
void g(int a) {
a ? 0 : 0 >> 32;
}
int main(void) {
f(1);
g(1);
}
instead, however, UBSan errors on the shift bug, but not on the overflowing
addition. when this program is run, this is the output we see:
/app/example.c:6:13: runtime error: shift exponent 32 is too large for 32-bit
type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /app/example.c:6:13 in
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs