public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Matthew Malcomson <matmal01@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/morello)] Implement build_zero_cst for INTCAP_TYPE
Date: Fri,  1 Oct 2021 09:17:03 +0000 (GMT)	[thread overview]
Message-ID: <20211001091703.F1EFC385842B@sourceware.org> (raw)

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


                 reply	other threads:[~2021-10-01  9:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211001091703.F1EFC385842B@sourceware.org \
    --to=matmal01@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).