public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] Implement build_zero_cst for INTCAP_TYPE
@ 2021-10-01  9:17 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2021-10-01  9:17 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2f2de95f4482dbd28440deb337b226b24b193843

commit 2f2de95f4482dbd28440deb337b226b24b193843
Author: Matthew Malcomson <matthew.malcomson@arm.com>
Date:   Tue Sep 21 16:01:59 2021 +0100

    Implement build_zero_cst for INTCAP_TYPE
    
    This does the same thing as a POINTER_TYPE, which means we don't fall
    through to the default of trying to convert `integer_zero_node` to the
    type we want.
    
    Also add a testcase where this missing implementation triggered an ICE.

Diff:
---
 gcc/testsuite/gcc.target/aarch64/morello/sra-modify-assign.c | 11 +++++++++++
 gcc/tree.c                                                   |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/aarch64/morello/sra-modify-assign.c b/gcc/testsuite/gcc.target/aarch64/morello/sra-modify-assign.c
new file mode 100644
index 00000000000..3a6846f5061
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/morello/sra-modify-assign.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* This testcase would trigger an ICE since the `esra` pass would attempt to
+   zero initialise the decomposed structure with `build_zero_cst` which was not
+   implemented for INTCAP_TYPE at the time.  */
+struct a {
+  long b;
+  __uintcap_t c;
+} d(int e) {
+  struct a a = {.c = e};
+  return a;
+}
diff --git a/gcc/tree.c b/gcc/tree.c
index 6a002a4708c..4b4f4fc3e61 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2421,7 +2421,7 @@ build_zero_cst (tree type)
   switch (TREE_CODE (type))
     {
     case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
-    case POINTER_TYPE: case REFERENCE_TYPE:
+    case POINTER_TYPE: case REFERENCE_TYPE: case INTCAP_TYPE:
     case OFFSET_TYPE: case NULLPTR_TYPE:
       return build_int_cst (type, 0);


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

only message in thread, other threads:[~2021-10-01  9:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01  9:17 [gcc(refs/vendors/ARM/heads/morello)] Implement build_zero_cst for INTCAP_TYPE Matthew Malcomson

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