diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-01-12 11:04:46 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-01-12 11:04:46 +0100 |
commit | 24ea113f75cfad38894dc1ad16b23c0538ef17d4 (patch) | |
tree | 1340c30d7161c93e6435fbccf4198251a6e76efb /gcc/gcov.c | |
parent | 13d47c37a2c043f3e5981e73e4c82158a39f41e8 (diff) | |
download | gcc-24ea113f75cfad38894dc1ad16b23c0538ef17d4.zip gcc-24ea113f75cfad38894dc1ad16b23c0538ef17d4.tar.gz gcc-24ea113f75cfad38894dc1ad16b23c0538ef17d4.tar.bz2 |
widening_mul: Fix up ICE caused by my signed multiplication overflow pattern recognition changes [PR98629]
As the testcase shows, my latest changes caused ICE on that testcase.
The problem is that arith_overflow_check_p now can change the use_stmt
argument (has a reference), so that if it succeeds (returns non-zero),
it points it to the GIMPLE_COND or EQ/NE or COND_EXPR assignment from the
TRUNC_DIV_EXPR assignment.
The problem was that it would change use_stmt also if it returned 0 in some
cases, such as multiple imm uses of the division, and in one of the callers
if arith_overflow_check_p returns 0 it looks at use_stmt again and performs
other checks, which of course assumes that use_stmt is the one passed
to arith_overflow_check_p and not e.g. NULL instead or some other unrelated
stmt.
The following patch fixes that by only changing use_stmt when we are about
to return non-zero (for the MULT_EXPR case, which is the only one with the
need to use different use_stmt).
2021-01-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/98629
* tree-ssa-math-opts.c (arith_overflow_check_p): Don't update use_stmt
unless returning non-zero.
* gcc.c-torture/compile/pr98629.c: New test.
Diffstat (limited to 'gcc/gcov.c')
0 files changed, 0 insertions, 0 deletions