public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mikhail Maltsev <maltsevm@gmail.com>
To: gcc-patches mailing list <gcc-patches@gcc.gnu.org>,
	 Uros Bizjak <ubizjak@gmail.com>, Jeff Law <law@redhat.com>
Subject: [PATCH, i386] PR68497. Fix ICE with -fno-checking
Date: Mon, 23 Nov 2015 23:20:00 -0000	[thread overview]
Message-ID: <56539C9F.9000903@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

Hi!

The attached patch fixes a problem introduced in r229567: the assertion

gcc_assert (is_sse);

is checked if flag_checking is false, and this causes an ICE when compiling with
-fno-checking.

Bootstrapped and regtested on x86_64-pc-linux-gnu. OK for trunk?

-- 
Regards,
    Mikhail Maltsev

gcc/ChangeLog:

2015-11-23  Mikhail Maltsev  <maltsevm@gmail.com>

	PR target/68497
	* config/i386/i386.c (output_387_binary_op): Fix assertion for
	-fno-checking case.

gcc/testsuite/ChangeLog:

2015-11-23  Mikhail Maltsev  <maltsevm@gmail.com>

	PR target/68497
	* gcc.target/i386/pr68497.c: New test.



[-- Attachment #2: pr68497.patch --]
[-- Type: text/x-patch, Size: 1715 bytes --]

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 83749d5..23dbb3a 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -17675,18 +17675,20 @@ output_387_binary_op (rtx insn, rtx *operands)
 
   /* Even if we do not want to check the inputs, this documents input
      constraints.  Which helps in understanding the following code.  */
-  if (flag_checking
-      && STACK_REG_P (operands[0])
-      && ((REG_P (operands[1])
-	   && REGNO (operands[0]) == REGNO (operands[1])
-	   && (STACK_REG_P (operands[2]) || MEM_P (operands[2])))
-	  || (REG_P (operands[2])
-	      && REGNO (operands[0]) == REGNO (operands[2])
-	      && (STACK_REG_P (operands[1]) || MEM_P (operands[1]))))
-      && (STACK_TOP_P (operands[1]) || STACK_TOP_P (operands[2])))
-    ; /* ok */
-  else
-    gcc_checking_assert (is_sse);
+  if (flag_checking)
+    {
+      if (STACK_REG_P (operands[0])
+	  && ((REG_P (operands[1])
+	       && REGNO (operands[0]) == REGNO (operands[1])
+	       && (STACK_REG_P (operands[2]) || MEM_P (operands[2])))
+	      || (REG_P (operands[2])
+		  && REGNO (operands[0]) == REGNO (operands[2])
+		  && (STACK_REG_P (operands[1]) || MEM_P (operands[1]))))
+	  && (STACK_TOP_P (operands[1]) || STACK_TOP_P (operands[2])))
+	; /* ok */
+      else
+	gcc_assert (is_sse);
+    }
 
   switch (GET_CODE (operands[3]))
     {
diff --git a/gcc/testsuite/gcc.target/i386/pr68497.c b/gcc/testsuite/gcc.target/i386/pr68497.c
new file mode 100644
index 0000000..0135cda
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr68497.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-checking" } */
+
+long double
+foo (long double x, long double y)
+{
+  return x + y;
+}

             reply	other threads:[~2015-11-23 23:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-23 23:20 Mikhail Maltsev [this message]
2015-11-24  0:04 ` Bernd Schmidt
2015-11-24 12:20   ` Mikhail Maltsev

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=56539C9F.9000903@gmail.com \
    --to=maltsevm@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=ubizjak@gmail.com \
    /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).