This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [LLVMdev] Handling of pointer difference in llvm-gcc and clang


So it seems like we agreed that this is a problem that should be fixed.

Shall I create a bug report suggesting for it?

Am Friday, 12. August 2011, 09:32:11 schrieb Richard Guenther:
> On Thu, Aug 11, 2011 at 10:36 PM, Joe Buck <Joe.Buck@synopsys.com> wrote:
> > 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.
> 
> Of course, I think that is what is being proposed.
> 
> Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]