public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/31568] ICE with invalid %y operand (inline-asm)
Date: Mon, 14 Jul 2008 12:43:00 -0000	[thread overview]
Message-ID: <20080714124316.21111.qmail@sourceware.org> (raw)
In-Reply-To: <bug-31568-6528@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-07-14 12:43 -------
Testing this patch right now:
Index: testsuite/gcc.target/powerpc/asm-y.c
===================================================================
--- testsuite/gcc.target/powerpc/asm-y.c        (revision 0)
+++ testsuite/gcc.target/powerpc/asm-y.c        (revision 0)
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+/* Test that %yN does not cause an internal error if used incorrectly.  */
+
+int f(int *a)
+{
+  asm ("#%y0" : "=m"(a[2])); /* { dg-error "try using the 'Z' constraint" } */
+  asm ("#%y0" : "=m"(a[1])); /* { dg-error "try using the 'Z' constraint" } */
+  asm ("#%y0" : "=m"(a[0]));
+}
Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c      (revision 137784)
+++ config/rs6000/rs6000.c      (working copy)
@@ -12288,9 +12288,13 @@ print_operand (FILE *file, rtx x, int co
          fprintf (file, "0,%s", reg_names[REGNO (tmp)]);
        else
          {
-           gcc_assert (GET_CODE (tmp) == PLUS
-                       && REG_P (XEXP (tmp, 0))
-                       && REG_P (XEXP (tmp, 1)));
+           if (!GET_CODE (tmp) == PLUS
+               || !REG_P (XEXP (tmp, 0))
+               || !REG_P (XEXP (tmp, 1)))
+             {
+               output_operand_lossage ("invalid %%y value, try using the 'Z'
constraint");
+               break;
+             }

            if (REGNO (XEXP (tmp, 0)) == 0)
              fprintf (file, "%s,%s", reg_names[ REGNO (XEXP (tmp, 1)) ],


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31568


  parent reply	other threads:[~2008-07-14 12:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-13 22:05 [Bug target/31568] New: " pinskia at gcc dot gnu dot org
2007-07-09  8:50 ` [Bug target/31568] " pinskia at gcc dot gnu dot org
2008-07-14 12:43 ` pinskia at gcc dot gnu dot org [this message]
2008-07-15 12:54 ` pinskia at gcc dot gnu dot org
2008-07-15 12:54 ` pinskia at gcc dot gnu dot org

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=20080714124316.21111.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).