http://llvm.org/bugs/show_bug.cgi?id=17490
Bug ID: 17490
Summary: ubsan: Left shift of negative value in c89
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
c89 doesn't seem to have the "If E1 has a signed type and nonnegative value,
and E1 × 2^E2 is representable in the result type, then that is the resulting
value; otherwise, the behavior is undefined." wording, so this diagnostic is
spurious:
sean:~/tmp % cat left_shift_negative.c
int main(int argc, char **argv) {
return (-argc) << 2;
}
sean:~/tmp % clang -std=c89 -fsanitize=undefined left_shift_negative.c
sean:~/tmp % ./a.out
left_shift_negative.c:2:18: runtime error: left shift of negative value -1
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs