public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] expr: Handle BITINT_TYPE in count_type_elements [PR112881]
@ 2023-12-07  7:51 Jakub Jelinek
  2023-12-07  7:57 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2023-12-07  7:51 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

Hi!

The following testcaser ICEs during gimplification, because
count_type_elements doesn't handle BITINT_TYPE.  It should handle it like
other integral types.

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

2023-12-07  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/112881
	* expr.cc (count_type_elements): Handle BITINT_TYPE like INTEGER_TYPE.

	* gcc.dg/bitint-50.c: New test.

--- gcc/expr.cc.jj	2023-12-01 08:10:43.037319912 +0100
+++ gcc/expr.cc	2023-12-06 17:36:15.437408307 +0100
@@ -7021,6 +7021,7 @@ count_type_elements (const_tree type, bo
     case REFERENCE_TYPE:
     case NULLPTR_TYPE:
     case OPAQUE_TYPE:
+    case BITINT_TYPE:
       return 1;
 
     case ERROR_MARK:
--- gcc/testsuite/gcc.dg/bitint-50.c.jj	2023-12-06 17:37:15.502565091 +0100
+++ gcc/testsuite/gcc.dg/bitint-50.c	2023-12-06 17:36:48.866939013 +0100
@@ -0,0 +1,21 @@
+/* PR middle-end/112881 */
+/* { dg-do compile { target bitint } } */
+/* { dg-options "-O2 -std=c23" } */
+
+struct S { _BitInt(64) b; };
+
+struct S
+foo (_BitInt(64) p)
+{
+  return (struct S) { p };
+}
+
+#if __BITINT_MAXWIDTH__ >= 3924
+struct T { _BitInt(3924) b; };
+
+struct T
+bar (_BitInt(3924) p)
+{
+  return (struct T) { p };
+}
+#endif

	Jakub


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

* Re: [PATCH] expr: Handle BITINT_TYPE in count_type_elements [PR112881]
  2023-12-07  7:51 [PATCH] expr: Handle BITINT_TYPE in count_type_elements [PR112881] Jakub Jelinek
@ 2023-12-07  7:57 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2023-12-07  7:57 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Thu, 7 Dec 2023, Jakub Jelinek wrote:

> Hi!
> 
> The following testcaser ICEs during gimplification, because
> count_type_elements doesn't handle BITINT_TYPE.  It should handle it like
> other integral types.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

> 2023-12-07  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/112881
> 	* expr.cc (count_type_elements): Handle BITINT_TYPE like INTEGER_TYPE.
> 
> 	* gcc.dg/bitint-50.c: New test.
> 
> --- gcc/expr.cc.jj	2023-12-01 08:10:43.037319912 +0100
> +++ gcc/expr.cc	2023-12-06 17:36:15.437408307 +0100
> @@ -7021,6 +7021,7 @@ count_type_elements (const_tree type, bo
>      case REFERENCE_TYPE:
>      case NULLPTR_TYPE:
>      case OPAQUE_TYPE:
> +    case BITINT_TYPE:
>        return 1;
>  
>      case ERROR_MARK:
> --- gcc/testsuite/gcc.dg/bitint-50.c.jj	2023-12-06 17:37:15.502565091 +0100
> +++ gcc/testsuite/gcc.dg/bitint-50.c	2023-12-06 17:36:48.866939013 +0100
> @@ -0,0 +1,21 @@
> +/* PR middle-end/112881 */
> +/* { dg-do compile { target bitint } } */
> +/* { dg-options "-O2 -std=c23" } */
> +
> +struct S { _BitInt(64) b; };
> +
> +struct S
> +foo (_BitInt(64) p)
> +{
> +  return (struct S) { p };
> +}
> +
> +#if __BITINT_MAXWIDTH__ >= 3924
> +struct T { _BitInt(3924) b; };
> +
> +struct T
> +bar (_BitInt(3924) p)
> +{
> +  return (struct T) { p };
> +}
> +#endif
> 
> 	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-07  8:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-07  7:51 [PATCH] expr: Handle BITINT_TYPE in count_type_elements [PR112881] Jakub Jelinek
2023-12-07  7:57 ` 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).