public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] dwarf2out: Fix ICE on large _BitInt in loc_list_from_tree_1 [PR113637]
@ 2024-01-31  8:35 Jakub Jelinek
  2024-01-31  9:03 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2024-01-31  8:35 UTC (permalink / raw)
  To: Richard Biener, Jason Merrill; +Cc: gcc-patches

Hi!

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.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

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.

--- gcc/dwarf2out.cc.jj	2024-01-24 13:11:21.132468150 +0100
+++ gcc/dwarf2out.cc	2024-01-30 17:23:41.249054946 +0100
@@ -19027,6 +19027,7 @@ loc_list_from_tree_1 (tree loc, int want
 		&& ! 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))
 	      {
--- gcc/testsuite/gcc.dg/bitint-80.c.jj	2024-01-30 17:30:02.843696120 +0100
+++ gcc/testsuite/gcc.dg/bitint-80.c	2024-01-30 17:32:33.301583203 +0100
@@ -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]);
+}

	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] dwarf2out: Fix ICE on large _BitInt in loc_list_from_tree_1 [PR113637]
  2024-01-31  8:35 [PATCH] dwarf2out: Fix ICE on large _BitInt in loc_list_from_tree_1 [PR113637] Jakub Jelinek
@ 2024-01-31  9:03 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2024-01-31  9:03 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Jason Merrill, gcc-patches

On Wed, 31 Jan 2024, Jakub Jelinek wrote:

> Hi!
> 
> 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.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK

> 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.
> 
> --- gcc/dwarf2out.cc.jj	2024-01-24 13:11:21.132468150 +0100
> +++ gcc/dwarf2out.cc	2024-01-30 17:23:41.249054946 +0100
> @@ -19027,6 +19027,7 @@ loc_list_from_tree_1 (tree loc, int want
>  		&& ! 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))
>  	      {
> --- gcc/testsuite/gcc.dg/bitint-80.c.jj	2024-01-30 17:30:02.843696120 +0100
> +++ gcc/testsuite/gcc.dg/bitint-80.c	2024-01-30 17:32:33.301583203 +0100
> @@ -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]);
> +}
> 
> 	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:[~2024-01-31  9:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-31  8:35 [PATCH] dwarf2out: Fix ICE on large _BitInt in loc_list_from_tree_1 [PR113637] Jakub Jelinek
2024-01-31  9:03 ` 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).