This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH][4.3] Deprecate -ftrapv
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Robert Dewar <dewar at adacore dot com>
- Cc: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>, mark at codesourcery dot com, gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org, rguenther at suse dot de
- Date: Sat, 1 Mar 2008 02:17:35 +0000 (UTC)
- Subject: Re: [PATCH][4.3] Deprecate -ftrapv
- References: <Pine.LNX.email@example.com> <47C89DB1.firstname.lastname@example.org> <10803010013.AA29088@vlsi1.ultra.nyu.edu> <47C8B9D4.email@example.com>
On Fri, 29 Feb 2008, Robert Dewar wrote:
> Well no one "needs" anything in this sense, any interfaced is Turing
> complete so there is *always* a work around deficiencies in the back end. But
> right now, the "do this itself" is really horribly inefficient:
You can see the C code in libgcc2.c (__addvSI3 etc.) used by -ftrapv (that
code depends on signed overflow wrapping as has been noted before, it
should of course be written with unsigned types). It does use
double-width types for multiplication (and some more complicated code for
multiplication of types that are already double-width).
If it were done at gimplification time I imagine something like the libgcc
code would be used, but with conversions to/from unsigned inserted as
needed. It would be possible to do optimizations at gimplification time
if one argument is constant (converting to a range check).
Joseph S. Myers