aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2024-01-31 10:56:15 +0100
committerJakub Jelinek <jakub@redhat.com>2024-01-31 10:56:15 +0100
commit457d2b59b58e5998e1e6967316d4e3e8f24edeed (patch)
tree83446f2ac06303bd6756c9231f4c15107ae29c38
parent90ac839a470d61ffcd9eee0d7d37ca9c385dfefb (diff)
downloadgcc-457d2b59b58e5998e1e6967316d4e3e8f24edeed.zip
gcc-457d2b59b58e5998e1e6967316d4e3e8f24edeed.tar.gz
gcc-457d2b59b58e5998e1e6967316d4e3e8f24edeed.tar.bz2
dwarf2out: Fix ICE on large _BitInt in loc_list_from_tree_1 [PR113637]
This spot uses SCALAR_INT_TYPE_MODE which obviously ICEs for large/huge BITINT_TYPE types which have BLKmode. But such large BITINT_TYPEs certainly don't fit into DWARF2_ADDR_SIZE either, so we can just assume it would be false if type has BLKmode. 2024-01-31 Jakub Jelinek <jakub@redhat.com> PR debug/113637 * dwarf2out.cc (loc_list_from_tree_1): Assume integral types with BLKmode are larger than DWARF2_ADDR_SIZE. * gcc.dg/bitint-80.c: New test.
-rw-r--r--gcc/dwarf2out.cc1
-rw-r--r--gcc/testsuite/gcc.dg/bitint-80.c15
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 2b72321..4b09c35 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -19027,6 +19027,7 @@ loc_list_from_tree_1 (tree loc, int want_address,
&& ! DECL_IGNORED_P (loc)
&& (INTEGRAL_TYPE_P (TREE_TYPE (loc))
|| POINTER_TYPE_P (TREE_TYPE (loc)))
+ && TYPE_MODE (TREE_TYPE (loc)) != BLKmode
&& (GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (TREE_TYPE (loc)))
<= DWARF2_ADDR_SIZE))
{
diff --git a/gcc/testsuite/gcc.dg/bitint-80.c b/gcc/testsuite/gcc.dg/bitint-80.c
new file mode 100644
index 0000000..0ad0935
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-80.c
@@ -0,0 +1,15 @@
+/* PR debug/113637 */
+/* { dg-do compile { target bitint } } */
+/* { dg-options "-g -std=c23" } */
+
+#if __BITINT_MAXWIDTH__ >= 639
+typedef _BitInt(639) B;
+#else
+typedef _BitInt(63) B;
+#endif
+
+void
+foo (B n)
+{
+ extern void bar (int [][n]);
+}