public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree: Handle BITINT_TYPE in type_contains_placeholder_1 [PR112511]
@ 2023-11-14  7:17 Jakub Jelinek
  2023-11-14  8:10 ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2023-11-14  7:17 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

Hi!

The following testcase ICEs because BITINT_TYPE isn't handled in
type_contains_placeholder_1.  Given that Ada doesn't emit it, it doesn't
matter that much where exactly we handle it as right now it should never
contain a placeholder; I've picked the same spot as INTEGER_TYPE, but if
you prefer e.g. the one with OFFSET_TYPE above, I can move it there too.

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

2023-11-14  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/112511
	* tree.cc (type_contains_placeholder_1): Handle BITINT_TYPE like
	INTEGER_TYPE.

	* gcc.dg/pr112511.c: New test.

--- gcc/tree.cc.jj	2023-11-09 09:04:20.357518740 +0100
+++ gcc/tree.cc	2023-11-13 14:57:33.001715799 +0100
@@ -4210,6 +4210,7 @@ type_contains_placeholder_1 (const_tree
       return false;
 
     case INTEGER_TYPE:
+    case BITINT_TYPE:
     case REAL_TYPE:
     case FIXED_POINT_TYPE:
       /* Here we just check the bounds.  */
--- gcc/testsuite/gcc.dg/pr112511.c.jj	2023-11-13 15:00:13.872457749 +0100
+++ gcc/testsuite/gcc.dg/pr112511.c	2023-11-13 14:59:59.933653398 +0100
@@ -0,0 +1,17 @@
+/* PR middle-end/112511 */
+/* { dg-do compile { target bitint } } */
+/* { dg-options "-O2" } */
+
+struct T { _BitInt(22) a; };
+
+void
+bar (struct T t)
+{
+}
+
+void
+foo (void)
+{
+  struct T t;
+  bar (t);
+}

	Jakub


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

* Re: [PATCH] tree: Handle BITINT_TYPE in type_contains_placeholder_1 [PR112511]
  2023-11-14  7:17 [PATCH] tree: Handle BITINT_TYPE in type_contains_placeholder_1 [PR112511] Jakub Jelinek
@ 2023-11-14  8:10 ` Richard Biener
  2023-11-14  8:14   ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2023-11-14  8:10 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Tue, 14 Nov 2023, Jakub Jelinek wrote:

> Hi!
> 
> The following testcase ICEs because BITINT_TYPE isn't handled in
> type_contains_placeholder_1.  Given that Ada doesn't emit it, it doesn't
> matter that much where exactly we handle it as right now it should never
> contain a placeholder; I've picked the same spot as INTEGER_TYPE, but if
> you prefer e.g. the one with OFFSET_TYPE above, I can move it there too.

Do we fill in TYPE_MIN/MAX_VALUE for BITINT_TYPE?  In that case the
patch is OK.  Otherwise I'd pick the OFFSET_TYPE place.

Thanks,
Richard.

> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> 2023-11-14  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/112511
> 	* tree.cc (type_contains_placeholder_1): Handle BITINT_TYPE like
> 	INTEGER_TYPE.
> 
> 	* gcc.dg/pr112511.c: New test.
> 
> --- gcc/tree.cc.jj	2023-11-09 09:04:20.357518740 +0100
> +++ gcc/tree.cc	2023-11-13 14:57:33.001715799 +0100
> @@ -4210,6 +4210,7 @@ type_contains_placeholder_1 (const_tree
>        return false;
>  
>      case INTEGER_TYPE:
> +    case BITINT_TYPE:
>      case REAL_TYPE:
>      case FIXED_POINT_TYPE:
>        /* Here we just check the bounds.  */
> --- gcc/testsuite/gcc.dg/pr112511.c.jj	2023-11-13 15:00:13.872457749 +0100
> +++ gcc/testsuite/gcc.dg/pr112511.c	2023-11-13 14:59:59.933653398 +0100
> @@ -0,0 +1,17 @@
> +/* PR middle-end/112511 */
> +/* { dg-do compile { target bitint } } */
> +/* { dg-options "-O2" } */
> +
> +struct T { _BitInt(22) a; };
> +
> +void
> +bar (struct T t)
> +{
> +}
> +
> +void
> +foo (void)
> +{
> +  struct T t;
> +  bar (t);
> +}
> 
> 	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] 3+ messages in thread

* Re: [PATCH] tree: Handle BITINT_TYPE in type_contains_placeholder_1 [PR112511]
  2023-11-14  8:10 ` Richard Biener
@ 2023-11-14  8:14   ` Jakub Jelinek
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Jelinek @ 2023-11-14  8:14 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

On Tue, Nov 14, 2023 at 08:10:21AM +0000, Richard Biener wrote:
> > The following testcase ICEs because BITINT_TYPE isn't handled in
> > type_contains_placeholder_1.  Given that Ada doesn't emit it, it doesn't
> > matter that much where exactly we handle it as right now it should never
> > contain a placeholder; I've picked the same spot as INTEGER_TYPE, but if
> > you prefer e.g. the one with OFFSET_TYPE above, I can move it there too.
> 
> Do we fill in TYPE_MIN/MAX_VALUE for BITINT_TYPE?  In that case the
> patch is OK.  Otherwise I'd pick the OFFSET_TYPE place.

We do (otherwise a lot of things would break).

	Jakub


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

end of thread, other threads:[~2023-11-14  8:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-14  7:17 [PATCH] tree: Handle BITINT_TYPE in type_contains_placeholder_1 [PR112511] Jakub Jelinek
2023-11-14  8:10 ` Richard Biener
2023-11-14  8:14   ` Jakub Jelinek

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).