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]

[PATCH] strength-reduction segfault


Hi!

The following testcase dies with sig11 on i386.
The problematic rtl is:
(insn 24 23 25 (parallel[
            (set (reg/v:SI 26)
                (plus:SI (reg/v:SI 26)
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ] ) 111 {*addsi_1} (nil)
    (nil))

(note 25 24 27 ("blob.i") 6 -1347440721)

(insn 27 25 28 (parallel[
            (set (reg/v:SI 29)
                (plus:SI (reg/v:SI 26)
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ] ) 111 {*addsi_1} (nil)
    (nil))

(note 28 27 31 ("blob.i") 7 -1347440721)

(note 31 28 34 ("blob.i") 8 -1347440721)

(insn 34 31 35 (set (mem:QI (reg/v:SI 26) 0)
        (const_int 0 [0x0])) 42 {*movqi_1} (nil)
    (nil))

(insn 35 34 36 (set (reg/v:SI 26)
        (reg/v:SI 29)) 32 {*movsi_1} (nil)
    (nil))

where strength_reduce starts the loop on insn 35 and v->insn is I think 24
or 25 (don't remember, can look it up), but -g inserts notes in between and
when we pass PATTERN of one of the NOTEs, it of course dies.
Will start bootstrap as soon as I figure out another solution for the cpp
#line issue.

2000-06-29  Jakub Jelinek  <jakub@redhat.com>

	* loop.c (strength_reduce): Allow line NOTEs in the chain.

	* gcc.dg/20000629-1.c: New test.

--- gcc/testsuite/gcc.dg/20000629-1.c.jj	Thu Jun 29 11:45:49 2000
+++ gcc/testsuite/gcc.dg/20000629-1.c	Thu Jun 29 11:46:07 2000
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+void foo(register char *p)
+{
+  char c, *q, *sp;
+  while (1) {
+    *p++=0;
+    sp=p+1;
+    c=*sp;
+    *p++=0;
+  }
+}
--- gcc/loop.c.jj	Fri Jun 16 13:10:29 2000
+++ gcc/loop.c	Thu Jun 29 11:44:33 2000
@@ -4249,8 +4249,9 @@ strength_reduce (loop, insn_count, flags
 	      /* Some bivs are incremented with a multi-insn sequence.
 		 The first insn contains the add.  */
 	      next_loc_insn = next->insn;
-	      while (! loc_mentioned_in_p (next->location,
-					   PATTERN (next_loc_insn)))
+	      while (! INSN_P (next_loc_insn)
+		     || ! loc_mentioned_in_p (next->location,
+					      PATTERN (next_loc_insn)))
 		next_loc_insn = PREV_INSN (next_loc_insn);
 
 	      if (next_loc_insn == v->insn)

	Jakub

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