diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-03-29 12:35:32 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-04-22 16:52:49 +0200 |
commit | 1ee66d06f25d5bf14e2f3b599fc391dc3d532722 (patch) | |
tree | 720806a78fd06a2fd784e47ced0475ab357d1a84 /gcc/print-rtl-function.c | |
parent | 698b03a66e5115c5dd5cf84bbb499e210df3e709 (diff) | |
download | gcc-1ee66d06f25d5bf14e2f3b599fc391dc3d532722.zip gcc-1ee66d06f25d5bf14e2f3b599fc391dc3d532722.tar.gz gcc-1ee66d06f25d5bf14e2f3b599fc391dc3d532722.tar.bz2 |
fold-const: Fix ICE in extract_muldiv_1 [PR99777]
extract_muldiv{,_1} is apparently only prepared to handle scalar integer
operations, the callers ensure it by only calling it if the divisor or
one of the multiplicands is INTEGER_CST and because neither multiplication
nor division nor modulo are really supported e.g. for pointer types, nullptr
type etc. But the CASE_CONVERT handling doesn't really check if it isn't
a cast from some other type kind, so on the testcase we end up trying to
build MULT_EXPR in POINTER_TYPE which ICEs. A few years ago Marek has
added ANY_INTEGRAL_TYPE_P checks to two spots, but the code uses
TYPE_PRECISION which means something completely different for vector types,
etc.
So IMNSHO we should just punt on conversions from non-integrals or
non-scalar integrals.
2021-03-29 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/99777
* fold-const.c (extract_muldiv_1): For conversions, punt on casts from
types other than scalar integral types.
* g++.dg/torture/pr99777.C: New test.
(cherry picked from commit afe9a630eae114665e77402ea083201c9d406e99)
Diffstat (limited to 'gcc/print-rtl-function.c')
0 files changed, 0 insertions, 0 deletions