diff mbox series

patch to fix PR83317

Message ID d4417517-e957-3716-8f48-d58d333ee5c9@redhat.com
State New
Headers show
Series patch to fix PR83317 | expand

Commit Message

Vladimir Makarov Dec. 8, 2017, 11:50 p.m. UTC
The following patch fixes

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83317

   The patch was successfully boostrapped and tested on x86-64.

   Committed as rev. 255517
diff mbox series

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 255516)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2017-12-08  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR rtl-optimization/83317
+	* lra-constraints.c (process_address_1): Add insn code check.
+
 2017-12-08  Michael Matz  <matz@suse.de>
 
 	Fix PR tree-optimization/83323
Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 255470)
+++ lra-constraints.c	(working copy)
@@ -3222,7 +3222,8 @@  process_address_1 (int nop, bool check_o
   /* Do not attempt to decompose arbitrary addresses generated by combine
      for asm operands with loose constraints, e.g 'X'.  */
   else if (MEM_P (op)
-	   && !(get_constraint_type (cn) == CT_FIXED_FORM
+	   && !(INSN_CODE (curr_insn) < 0
+		&& get_constraint_type (cn) == CT_FIXED_FORM
 	        && constraint_satisfied_p (op, cn)))
     decompose_mem_address (&ad, op);
   else if (GET_CODE (op) == SUBREG
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 255516)
+++ testsuite/ChangeLog	(working copy)
@@ -1,5 +1,10 @@ 
 2017-12-08  Jakub Jelinek  <jakub@redhat.com>
 
+	PR rtl-optimization/83317
+	* gcc.target/i386/pr83317.c: New test.
+
+2017-12-08  Jakub Jelinek  <jakub@redhat.com>
+
 	PR rtl-optimization/81595
 	* gcc.c-torture/compile/pr81595.c: New test.
 
Index: testsuite/gcc.target/i386/pr83317.c
===================================================================
--- testsuite/gcc.target/i386/pr83317.c	(nonexistent)
+++ testsuite/gcc.target/i386/pr83317.c	(working copy)
@@ -0,0 +1,21 @@ 
+/* PR rtl-optimization/83317 */
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+/* { dg-additional-options "-fPIC" { target fpic } } */
+/* { dg-additional-options "-msse2 -mfpmath=sse" { target ia32 } } */
+
+struct S { double a; };
+struct S c;
+int d, e;
+void *buf[64];
+extern int setjmp (void **);
+
+void
+foo ()
+{
+  setjmp (buf);
+  struct S g;
+  if (d)
+    g.a = __builtin_copysign (e, d);
+  c = g;
+}