[LLVMdev] Handling of pointer difference in llvm-gcc and clang
Joe Buck
Joe.Buck@synopsys.com
Thu Aug 11 20:39:00 GMT 2011
On Thu, Aug 11, 2011 at 1:58 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> -ftrapv and -fwrapv should have no effect on pointer subtraction.
Gaby writes:
> Yes!
Wouldn't it suffice to convert the pointers to unsigned, do an unsigned subtraction, and then convert the result to signed? This would then guarantee that gcc uses two's complement semantics, independent of -ftrapv.
More information about the Gcc
mailing list