search for: pointer_diff

Displaying 2 results from an estimated 2 matches for "pointer_diff".

2011 Aug 10
0
[LLVMdev] Handling of pointer difference in llvm-gcc and clang
...718_6 = D.2717_5 /[ex] 4; D.2714_7 = (int) D.2718_6; return D.2714_7; } Signed overflow in the difference of two long int (ptrdiff_t) values results in undefined behaviour according to the GCC type system, which is where the nsw flag comes from. The C front-end generates this gimple in the pointer_diff routine. The above is basically a direct transcription of what pointer_diff does. In short, I don't know if this is right or wrong; but if it is wrong it seems to be a bug in GCC's C frontend. Ciao, Duncan.
2011 Aug 10
3
[LLVMdev] Handling of pointer difference in llvm-gcc and clang
Hi, We are developing a bounded model checker for C/C++ programs (http://baldur.iti.kit.edu/llbmc/) that operates on LLVM's intermediate representation. While checking a C++ program that uses STL containers we noticed that llvm-gcc and clang handle pointer differences in disagreeing ways. Consider the following C function: int f(int *p, int *q) { return q - p; } Here's the