[PATCH committed][SH] Fix build error

Kaz Kojima kkojima@rr.iij4u.or.jp
Sat Nov 16 04:00:00 GMT 2013


Hi,

sh4-unknown-linux-gnu fails to build during compiling libobjc:

/exp/ldroot/dodes/ORIG/trunk/libobjc/encoding.c: In function 'objc_alignof_type':
/exp/ldroot/dodes/ORIG/trunk/libobjc/encoding.c:620:1: internal compiler error: Segmentation fault
 }
 ^
0x860f910 crash_signal
	../../ORIG/trunk/gcc/toplev.c:334
0x88c3f61 barrier_align(rtx_def*)
	../../ORIG/trunk/gcc/config/sh/sh.c:5780
0x88c2956 find_barrier
	../../ORIG/trunk/gcc/config/sh/sh.c:5157

There is a corner case which barrier_align is called with a null
argument and it hits the recent rearrange of barrier_align.
The attached patch is to fix this.
Tested on sh4-unknown-linux-gnu.  Committed.

Regards,
	kaz
--
2013-11-15  Kaz Kojima  <kkojima@gcc.gnu.org>

	* config/sh/sh.c (barrier_align): Return 0 when barrier_or_label
	is null.

diff -up ORIG/trunk/gcc/config/sh/sh.c trunk/gcc/config/sh/sh.c
--- ORIG/trunk/gcc/config/sh/sh.c	2013-11-15 19:33:51.000000000 +0900
+++ trunk/gcc/config/sh/sh.c	2013-11-15 19:59:29.000000000 +0900
@@ -5777,6 +5777,9 @@ barrier_align (rtx barrier_or_label)
 {
   rtx next, pat;
 
+  if (! barrier_or_label)
+    return 0;
+
   if (LABEL_P (barrier_or_label)
       && NEXT_INSN (barrier_or_label)
       && JUMP_TABLE_DATA_P (NEXT_INSN (barrier_or_label)))



More information about the Gcc-patches mailing list