[PATCH] Fix PR middle-end/38590: ice: verify_gimple failed with divide

Andrew Pinski pinskia@gmail.com
Mon Dec 22 19:51:00 GMT 2008


Hi,
  With strict overflow turned on, we would optimize "1 / (int)
-(unsigned int)p_76" into "((int)-1) /  (unsigned int)p_76" which had
the wrong type.  Fixed by adding fold_convert in fold_binary for this
optimization to get the correct types.

OK? Bootstrapped and tested on i386-darwin8.11 with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
* fold-const.c (fold_binary): Call fold_convert on arguments to
fold_build2 for negative divide optimization.

* gcc.c-torture/compile/pr38590-1.c: New testcase.
* gcc.c-torture/compile/pr38590-2.c: New testcase.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fixdivopttype.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081222/93ed5054/attachment.txt>


More information about the Gcc-patches mailing list