* [PATCH] lower-bitint: Fix ICE on bitint-39.c
@ 2023-12-01 7:34 Jakub Jelinek
2023-12-01 7:51 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2023-12-01 7:34 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
Hi!
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.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok
for trunk?
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.
--- gcc/gimple-lower-bitint.cc.jj 2023-11-30 10:57:40.095555940 +0100
+++ gcc/gimple-lower-bitint.cc 2023-11-30 12:46:34.715093396 +0100
@@ -3682,6 +3682,8 @@ bitint_large_huge::finish_arith_overflow
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;
}
}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] lower-bitint: Fix ICE on bitint-39.c
2023-12-01 7:34 [PATCH] lower-bitint: Fix ICE on bitint-39.c Jakub Jelinek
@ 2023-12-01 7:51 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2023-12-01 7:51 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches
On Fri, 1 Dec 2023, Jakub Jelinek wrote:
> Hi!
>
> 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.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok
> for trunk?
OK.
> 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.
>
> --- gcc/gimple-lower-bitint.cc.jj 2023-11-30 10:57:40.095555940 +0100
> +++ gcc/gimple-lower-bitint.cc 2023-11-30 12:46:34.715093396 +0100
> @@ -3682,6 +3682,8 @@ bitint_large_huge::finish_arith_overflow
> 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;
> }
> }
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-01 7:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-01 7:34 [PATCH] lower-bitint: Fix ICE on bitint-39.c Jakub Jelinek
2023-12-01 7:51 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).