PATCH RFC: Warn about pointer wraparound with -Wstrict-overflow
Richard Guenther
richard.guenther@gmail.com
Tue Apr 8 21:56:00 GMT 2008
On Tue, Apr 8, 2008 at 11:42 PM, Mark Mitchell <mark@codesourcery.com> wrote:
> 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.
Of course addressing mode issues only come into play if we use them for
address computation (like with lea on x86) - do we in this case?
Richard.
More information about the Gcc-patches
mailing list