http://llvm.org/bugs/show_bug.cgi?id=18803
Bug ID: 18803
Summary: No -Wsequence-point warning for undefined behavior in
"a[*p] = (*p += 1)"
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
I suppose there should be an undefined behavior on *p. Gcc warns this behavior.
$: cat s.c
void fn(int* p) {
int a[2] = {1, 2};
a[*p] = (*p += 1);
}
$: clang-trunk -Wsequence-point -c s.c
$: gcc-trunk -Wsequence-point -c s.c
s.c: In function ‘fn’:
s.c:3:15: warning: operation on ‘*p’ may be undefined [-Wsequence-point]
a[*p] = (*p += 1);
^
$: clang-trunk --version
clang version 3.5 (trunk 201116)
Target: x86_64-unknown-linux-gnu
Thread model: posix
--
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