public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-6265] expr: Handle BITINT_TYPE in count_type_elements [PR112881]
@ 2023-12-07  8:48 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2023-12-07  8:48 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:e5489faf8efa30d8548bb669c0a700c409068bce

commit r14-6265-ge5489faf8efa30d8548bb669c0a700c409068bce
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Dec 7 09:47:16 2023 +0100

    expr: Handle BITINT_TYPE in count_type_elements [PR112881]
    
    The following testcaser ICEs during gimplification, because
    count_type_elements doesn't handle BITINT_TYPE.  It should handle it like
    other integral types.
    
    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.

Diff:
---
 gcc/expr.cc                      |  1 +
 gcc/testsuite/gcc.dg/bitint-50.c | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/gcc/expr.cc b/gcc/expr.cc
index fea719028a1..6da51f2aca2 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -7021,6 +7021,7 @@ count_type_elements (const_tree type, bool for_ctor_p)
     case REFERENCE_TYPE:
     case NULLPTR_TYPE:
     case OPAQUE_TYPE:
+    case BITINT_TYPE:
       return 1;
 
     case ERROR_MARK:
diff --git a/gcc/testsuite/gcc.dg/bitint-50.c b/gcc/testsuite/gcc.dg/bitint-50.c
new file mode 100644
index 00000000000..ea7820eafd7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-50.c
@@ -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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-07  8:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-07  8:48 [gcc r14-6265] expr: Handle BITINT_TYPE in count_type_elements [PR112881] 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).