This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: New no-undefined-overflow branch
On Fri, 6 Mar 2009, Paolo Bonzini wrote:
> I don't think you need to introduce trapping tree codes. You can
> introduce them directly in the front-end as
Multiple front ends want the same thing. This is why it would be better
to introduce the codes in GENERIC and have the language-independent
gimplifier contain the code to lower them, even if they don't become part
of GIMPLE.
> (int)((long long) a * (long long) b) == a *nv b ? trap () : a *nv b
This is not a solution for trapping multiplication in the widest supported
type. I'm sure you can represent that with e.g. some checks for whether
values are positive or negative and then dividing the largest / smallest
values of the type by one of the arguments, but you might not want to lose
symmetry like that until after constant propagation has had a chance to
make one of the arguments constant (since if that happens you get a range
check on the other argument).
--
Joseph S. Myers
joseph@codesourcery.com