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  <ja...@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 <rguent...@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to