Re: [cfe-users] dereferencing null pointers

2016-04-25 Thread David Blaikie via cfe-users
Short answer: No, unfortunately. Longer answer: The runtime failure should help you catch these. Clang does have a diagnostic for /really/ obvious cases of null dereference: null.c:3:3: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference] *((int*)NULL

[cfe-users] dereferencing null pointers

2016-04-25 Thread Zenith432 via cfe-users
target is x86_64-apple-darwin15.4.0 (Apple LLVM 7.3.0) This function = vec.c = #include int vec(int index) { return ((int*) NULL)[index]; } === [Yes, I know it's undefined behavior in ansi C]. Compiled with "clang -c -O0 -o vec.o vec.c" yields this code = 000