aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2024-07-17 17:32:21 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2024-07-17 17:32:21 +0200
commit5104fe4c7808a66ed3041a8da8e4720585cc8a1f (patch)
tree8e59a5d60e366fe4e0bf7dd47425cbb22586b637
parentd8a75353dded30a7ecdef2807ad101a02743d4a9 (diff)
downloadgcc-5104fe4c7808a66ed3041a8da8e4720585cc8a1f.zip
gcc-5104fe4c7808a66ed3041a8da8e4720585cc8a1f.tar.gz
gcc-5104fe4c7808a66ed3041a8da8e4720585cc8a1f.tar.bz2
bitint: Use gsi_insert_on_edge rather than gsi_insert_on_edge_immediate [PR115887]
The following testcase ICEs on x86_64-linux, because we try to gsi_insert_on_edge_immediate a statement on an edge which already has statements queued with gsi_insert_on_edge, and the deferral has been intentional so that we don't need to deal with cfg changes in between. The following patch uses the delayed insertion as well. 2024-07-17 Jakub Jelinek <jakub@redhat.com> PR middle-end/115887 * gimple-lower-bitint.cc (gimple_lower_bitint): Use gsi_insert_on_edge instead of gsi_insert_on_edge_immediate and set edge_insertions to true. * gcc.dg/bitint-108.c: New test.
-rw-r--r--gcc/gimple-lower-bitint.cc3
-rw-r--r--gcc/testsuite/gcc.dg/bitint-108.c38
2 files changed, 40 insertions, 1 deletions
diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc
index f955f3e..b105930 100644
--- a/gcc/gimple-lower-bitint.cc
+++ b/gcc/gimple-lower-bitint.cc
@@ -6903,7 +6903,8 @@ gimple_lower_bitint (void)
if (stmt_ends_bb_p (stmt))
{
edge e = find_fallthru_edge (gsi_bb (gsi)->succs);
- gsi_insert_on_edge_immediate (e, g);
+ gsi_insert_on_edge (e, g);
+ edge_insertions = true;
}
else
gsi_insert_after (&gsi, g, GSI_SAME_STMT);
diff --git a/gcc/testsuite/gcc.dg/bitint-108.c b/gcc/testsuite/gcc.dg/bitint-108.c
new file mode 100644
index 0000000..170d4bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-108.c
@@ -0,0 +1,38 @@
+/* PR middle-end/115887 */
+/* { dg-do compile { target { bitint && int128 } } } */
+/* { dg-options "-O -fnon-call-exceptions -finstrument-functions -w" } */
+
+float f;
+#if __BITINT_MAXWIDTH__ >= 1024
+#define N1024 1024
+#define N127 127
+#define N256 256
+#else
+#define N1024 64
+#define N127 64
+#define N256 64
+#endif
+
+_BitInt(N1024) a;
+
+static inline void
+bar (_BitInt(N127) b, _BitInt(N256) c, int,
+ int, int, int, int, int, int, int, int,
+ int, int, int, int, int, int, int, int,
+ int *)
+{
+ b %= 0;
+ do
+ c -= *(short *) 0;
+ while (__builtin_add_overflow_p (a, 0, 0));
+ __int128 d = b + c + f;
+}
+
+void
+foo (void)
+{
+ int x;
+ bar (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &x);
+ while (x)
+ ;
+}