PATCH RFC: Warn about pointer wraparound with -Wstrict-overflow

Mark Mitchell mark@codesourcery.com
Tue Apr 8 21:54:00 GMT 2008


Andrew Pinski wrote:
> On Tue, Apr 8, 2008 at 12:44 PM, Paul Brook <paul@codesourcery.com> wrote:
>>  On some targets (e.g. ARM) I believe base+offset addressing modes are
>>  undefined if the calculation overflows.  So to implement -fwrapv for pointers
>>  reliably you may need to disable these adressing modes.
> 
> HPPA for sure. 

That seems like a pretty compelling argument.  Wrapping semantics are 
pretty easy for integers; everyone's hardware works that way.  If 
wrapping semantics are hard to implement for pointers, then maybe we 
shouldn't try to make -fwrapv work there.  In that case, the manual 
might be improved by saying "... integers (but not pointers)" so that we 
know that it really means it.  We might even have a note that mentions 
these kinds of hardware platforms.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list