diff options
author | Jakub Jelinek <jakub@redhat.com> | 2023-12-01 09:26:24 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2023-12-01 09:26:24 +0100 |
commit | 0ef93c86f7610357079197df8a198a2f57dc1713 (patch) | |
tree | 9fd47c59b619bf746f2df0045182925325a46dea | |
parent | 364332658ef790d09d250db39c5b13e27c3543f1 (diff) | |
download | gcc-0ef93c86f7610357079197df8a198a2f57dc1713.zip gcc-0ef93c86f7610357079197df8a198a2f57dc1713.tar.gz gcc-0ef93c86f7610357079197df8a198a2f57dc1713.tar.bz2 |
lower-bitint: Fix ICE on bitint-39.c
torture/bitint-39.c ICEs with -O1; the problem is that the
finish_arith_overflow code in one spot replaces use_stmt with an
assignment or cast, but if unlucky and m_gsi iterator is the same statement,
when the code later
tree clobber = build_clobber (TREE_TYPE (var), CLOBBER_EOL);
g = gimple_build_assign (var, clobber);
gsi_insert_after (&m_gsi, g, GSI_SAME_STMT);
it will insert after iterator which contains already replaced statement and
that causes the gimple chain corruption.
2023-12-01 Jakub Jelinek <jakub@redhat.com>
* gimple-lower-bitint.cc (bitint_large_huge::finish_arith_overflow):
When replacing use_stmt which is gsi_stmt (m_gsi), update m_gsi to
the new statement.
-rw-r--r-- | gcc/gimple-lower-bitint.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc index 09eb7a3..7000931 100644 --- a/gcc/gimple-lower-bitint.cc +++ b/gcc/gimple-lower-bitint.cc @@ -3682,6 +3682,8 @@ bitint_large_huge::finish_arith_overflow (tree var, tree obj, tree type, else g = gimple_build_assign (lhs2, NOP_EXPR, ovf); gsi_replace (&gsi, g, true); + if (gsi_stmt (m_gsi) == use_stmt) + m_gsi = gsi_for_stmt (g); break; } } |