This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix a bunch of ia64 compile-time crashes


Jan's performance patches exposed a latent bug in the ia64 back end
which manifested as crashes in the test suite:

FAIL: gcc.c-torture/compile/20001205-1.c (test for excess errors)
FAIL: gcc.c-torture/compile/20010605-3.c (test for excess errors)
FAIL: gcc.c-torture/compile/20010605-3.c (test for excess errors)
FAIL: gcc.c-torture/compile/20010605-3.c (test for excess errors)
FAIL: gcc.c-torture/compile/20010605-3.c (test for excess errors)
FAIL: gcc.dg/20030405-1.c (test for excess errors)

In short - match_dup expressions must appear lexically after their
corresponding match_operand expressions in all machine description
patterns.  Before the performance patches, these would simply fail
to match, as the operands array was cleared to zero before calling
recog; but now recog calls rtx_equal_p on garbage data.

Fixed by swapping all the offending match_operand and match_dup
expressions.  Jan has a patch which makes genrecog detect these
and error out, which I encourage him to clean up and submit. 
For right now I'm just going to fix the ia64 machine description.
I consider this patch pretty obvious, but I'm going to hold off
applying it (to both 3.4 and mainline) for a little while in case
someone knows different.

Bootstrapped ia64-hpux; I could only run the C testsuite, due to
dwarf2 crashes while compiling libstdc++.

zw

        * config/ia64/ia64.md (fetchadd_acq_si, fetchadd_acq_di)
        (cmpxchg_acq_si, cmpxchg_acq_di): Exchange match_dup and
        match_operand expressions so that all match_dups appear
        lexically after their corresponding match_operands.

===================================================================
Index: config/ia64/ia64.md
--- config/ia64/ia64.md	28 Jan 2004 18:13:28 -0000	1.121
+++ config/ia64/ia64.md	28 Jan 2004 20:43:28 -0000
@@ -5794,8 +5794,8 @@
 
 (define_insn "fetchadd_acq_si"
   [(set (match_operand:SI 0 "gr_register_operand" "=r")
-	(match_dup 1))
-   (set (match_operand:SI 1 "not_postinc_memory_operand" "+S")
+	(match_operand:SI 1 "not_postinc_memory_operand" "+S"))
+   (set (match_dup 1)
 	(unspec:SI [(match_dup 1)
 		    (match_operand:SI 2 "fetchadd_operand" "n")]
 		   UNSPEC_FETCHADD_ACQ))]
@@ -5805,8 +5805,8 @@
 
 (define_insn "fetchadd_acq_di"
   [(set (match_operand:DI 0 "gr_register_operand" "=r")
-	(match_dup 1))
-   (set (match_operand:DI 1 "not_postinc_memory_operand" "+S")
+	(match_operand:DI 1 "not_postinc_memory_operand" "+S"))
+   (set (match_dup 1)
 	(unspec:DI [(match_dup 1)
 		    (match_operand:DI 2 "fetchadd_operand" "n")]
 		   UNSPEC_FETCHADD_ACQ))]
@@ -5816,8 +5816,8 @@
 
 (define_insn "cmpxchg_acq_si"
   [(set (match_operand:SI 0 "gr_register_operand" "=r")
-	(match_dup 1))
-   (set (match_operand:SI 1 "not_postinc_memory_operand" "+S")
+	(match_operand:SI 1 "not_postinc_memory_operand" "+S"))
+   (set (match_dup 1)
         (unspec:SI [(match_dup 1)
                     (match_operand:SI 2 "gr_register_operand" "r")
 		    (match_operand:DI 3 "ar_ccv_reg_operand" "")]
@@ -5828,8 +5828,8 @@
 
 (define_insn "cmpxchg_acq_di"
   [(set (match_operand:DI 0 "gr_register_operand" "=r")
-	(match_dup 1))
-   (set (match_operand:DI 1 "not_postinc_memory_operand" "+S")
+	(match_operand:DI 1 "not_postinc_memory_operand" "+S"))
+   (set (match_dup 1)
         (unspec:DI [(match_dup 1)
                     (match_operand:DI 2 "gr_register_operand" "r")
 		    (match_operand:DI 3 "ar_ccv_reg_operand" "")]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]