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 [EMAIL PROTECTED]