public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alex Coplan <acoplan@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/morello)] valtrack.c: Fix ICE via cleanup_auto_inc_dec
Date: Tue, 12 Jul 2022 10:36:59 +0000 (GMT)	[thread overview]
Message-ID: <20220712103659.586F63857BAB@sourceware.org> (raw)

https://gcc.gnu.org/g:789c38b3ebf63693034b28d32c1b82b9dc3d0406

commit 789c38b3ebf63693034b28d32c1b82b9dc3d0406
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Thu Jun 23 14:39:01 2022 +0100

    valtrack.c: Fix ICE via cleanup_auto_inc_dec
    
    gcc/ChangeLog:
    
            * valtrack.c (cleanup_auto_inc_dec): Handle capability modes for
            PRE_{INC,DEC}.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/aarch64/morello/valtrack-ice.c: New test.

Diff:
---
 gcc/testsuite/gcc.target/aarch64/morello/valtrack-ice.c | 15 +++++++++++++++
 gcc/valtrack.c                                          |  9 ++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gcc.target/aarch64/morello/valtrack-ice.c b/gcc/testsuite/gcc.target/aarch64/morello/valtrack-ice.c
new file mode 100644
index 00000000000..871b62e96cd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/morello/valtrack-ice.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O2 -g" } */
+void fmtinfo(char *fmt) {
+  int c = 0;
+  do {
+    switch (c) {
+    default:
+      if ((c = fmt[1]) && c != 'l')
+      case '.':
+        if (fmt)
+          --fmt;
+    }
+  }
+  while (c = *++fmt);
+}
diff --git a/gcc/valtrack.c b/gcc/valtrack.c
index 74259f25fa8..6d8e16c4581 100644
--- a/gcc/valtrack.c
+++ b/gcc/valtrack.c
@@ -99,9 +99,12 @@ cleanup_auto_inc_dec (rtx src, machine_mode mem_mode ATTRIBUTE_UNUSED)
 	poly_int64 offset = GET_MODE_SIZE (mem_mode);
 	if (code == PRE_DEC)
 	  offset = -offset;
-	return gen_rtx_PLUS (GET_MODE (x),
-			     cleanup_auto_inc_dec (XEXP (x, 0), mem_mode),
-			     gen_int_mode (offset, GET_MODE (x)));
+
+	const auto sa = as_a <scalar_addr_mode> (GET_MODE (x));
+	return gen_raw_pointer_plus (sa,
+				     cleanup_auto_inc_dec (XEXP (x, 0),
+							   mem_mode),
+				     gen_int_mode (offset, offset_mode (sa)));
       }
 
     case POST_INC:


                 reply	other threads:[~2022-07-12 10:36 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=20220712103659.586F63857BAB@sourceware.org \
    --to=acoplan@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).