]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/35225 (gcc segfaults when building GTK+ code with -O2 -fPIC...
authorKaz Kojima <kkojima@gcc.gnu.org>
Sun, 9 Mar 2008 23:39:51 +0000 (23:39 +0000)
committerKaz Kojima <kkojima@gcc.gnu.org>
Sun, 9 Mar 2008 23:39:51 +0000 (23:39 +0000)
Backport from mainline:
PR target/35225
* config/sh/sh.c (find_barrier): Don't go past 'from' argument.

From-SVN: r133066

gcc/ChangeLog
gcc/config/sh/sh.c

index 39b338774437540ceb513085680ebf30cfb168b2..86cdf281a0bcdf3390ce65ab2fc8ba7abc9b2462 100644 (file)
@@ -1,3 +1,9 @@
+2008-03-09  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       Backport from mainline:
+       PR target/35225
+       * config/sh/sh.c (find_barrier): Don't go past 'from' argument.
+
 2008-03-07  Joseph Myers  <joseph@codesourcery.com>
 
        * doc/include/texinfo.tex: Update to version 2008-03-07.10.
index f567afbef696ee34a7f765f08c92792470767f18..43efeb3f7446fa2b938d3f360c54c95934b5580b 100644 (file)
@@ -3530,6 +3530,7 @@ find_barrier (int num_mova, rtx mova, rtx from)
   rtx barrier_before_mova = 0, found_barrier = 0, good_barrier = 0;
   int si_limit;
   int hi_limit;
+  rtx orig = from;
 
   /* For HImode: range is 510, add 4 because pc counts from address of
      second instruction after this one, subtract 2 for the jump instruction
@@ -3753,7 +3754,8 @@ find_barrier (int num_mova, rtx mova, rtx from)
       /* If we exceeded the range, then we must back up over the last
         instruction we looked at.  Otherwise, we just need to undo the
         NEXT_INSN at the end of the loop.  */
-      if (count_hi > hi_limit || count_si > si_limit)
+      if (PREV_INSN (from) != orig
+         && (count_hi > hi_limit || count_si > si_limit))
        from = PREV_INSN (PREV_INSN (from));
       else
        from = PREV_INSN (from);