I have a question regarding the catch-undefined -behavior flag in clang. I tried this in a large project written in C, where at some point the integer value (i) provided by the user comes in. Then I added the following code:
int arr[3] arr[i] = 1234;
But when I run the code using gdb, it stops only when the variable I have is 4 or more. Therefore, when I pass the value 3 to i, it still accesses the array outside of it, not stopping.
Is this a known limitation of -fcatch- undefined -behavior? Or does it only check if access is outside the stack frame, and not outside the local arrays?
Regards Christian
PS: I use clang + llvm 3.0 as a compiler / linker. The target is x86. The program runs inside the xubuntu 12.04 virtual machine in a Windows XP window.
source share