diff mbox

[i386] PR68497. Fix ICE with -fno-checking

Message ID 56539C9F.9000903@gmail.com
State New
Headers show

Commit Message

Mikhail Maltsev Nov. 23, 2015, 11:09 p.m. UTC
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?

Comments

Bernd Schmidt Nov. 23, 2015, 11:43 p.m. UTC | #1
On 11/24/2015 12:09 AM, Mikhail Maltsev wrote:
> 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.
>
Ok.


Bernd
Mikhail Maltsev Nov. 24, 2015, 12:19 p.m. UTC | #2
On 11/24/2015 02:43 AM, Bernd Schmidt wrote:
> On 11/24/2015 12:09 AM, Mikhail Maltsev wrote:
>> 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.
>>
> Ok.
> 
> 
> Bernd
> 

Committed as r230803.
diff mbox

Patch

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;
+}