[CVS 980408]: Patch for test failure gcc.dg/980226-1.c

Manfred Hollstein manfred@s-direktnet.de
Thu Apr 9 11:23:00 GMT 1998


Running make check with CVS sources updated at 1998/04/08 16:47:39
MEST gives an internal compiler error.

gdb shows the following:

(gdb) r 980226-1.i -quiet -dumpbase 980226-1.c -O2 -version -o 980226-1.s
Starting program: /home/manfred/work/GNU/egcs-980408-i586-linux-gnulibc1/gcc/cc1 980226-1.i -quiet -dumpbase 980226-1.c -O2 -version -o 980226-1.s
Breakpoint 1 at 0x4005df18
GNU C version egcs-2.91.22 980404 (gcc2 ss-980401 experimental) (i586-linux-gnulibc1) compiled by GNU C version egcs-2.91.22 980404 (gcc2 ss-980401 experimental).

Program received signal SIGSEGV, Segmentation fault.
0x81c01c2 in constrain_asm_operands (n_operands=0, operands=0xbfffea68, 
    operand_constraints=0xbfffea40, operand_matches=0xbfffe918, 
    operand_class=0xbfffe918) at ../../egcs-980408/gcc/reg-stack.c:641
(gdb) p constraints
$1 = (char **) 0xbfffe8c8
(gdb) p constraints[0]
$2 = 0x0
(gdb) p q
$3 = 0x0
(gdb) 

The patch below fixes this.

manfred

Thu Apr  9 19:47:18 1998  Manfred Hollstein  <manfred@s-direktnet.de>

	* reg-stack.c (constrain_asm_operands): Add check against 0 before
	dereferencing pointer.

diff -rup -x CVS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-980408.orig/gcc/reg-stack.c egcs-980408/gcc/reg-stack.c
--- egcs-980408.orig/gcc/reg-stack.c	Wed Apr  8 14:35:45 1998
+++ egcs-980408/gcc/reg-stack.c	Thu Apr  9 19:46:55 1998
@@ -638,7 +638,7 @@ constrain_asm_operands (n_operands, oper
      alternatives.  */
 
   n_alternatives = 1;
-  for (q = constraints[0]; *q; q++)
+  for (q = constraints[0]; q && *q; q++)
     n_alternatives += (*q == ',');
 
   this_alternative = 0;



More information about the Gcc-bugs mailing list