This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Attachment: fixdivopttype.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]