This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Crash while scanning queued lists
- To: gcc-patches at gcc dot gnu dot org
- Subject: Crash while scanning queued lists
- From: Alexandre Oliva <aoliva at cygnus dot com>
- Date: 18 May 2000 06:40:35 -0300
- Organization: Cygnus Solutions, a Red Hat Company
gcc.c-torture/execute/va-arg-5.c (and a couple of other va-arg tests)
won't compile with -O0 or -O1 on the mn10300 port. The problem is
that, given this insn:
(insn 39 37 41 (set (reg:SI 30)
(reg:SI 0 d0)) -1 (nil)
(insn_list:REG_RETVAL 31 (expr_list:REG_EQUAL (expr_list (symbol_ref:SI ("__nedf2"))
(expr_list (const_double:DF (const_int 0 [0x0]) 4614256655080292474 [0x400921fafc8b007a] 0 [0x0] [3.141592])
(expr_list (mem:DF (queued:SI (reg:SI 27)
(insn 27 34 28 (set (reg:SI 27)
(plus:SI (reg:SI 27)
(const_int 8 [0x8]))) -1 (nil)
(nil))
(nil)
(set (reg:SI 27)
(plus:SI (reg:SI 27)
(const_int 8 [0x8])))
(queued:SI (mem/f:SI (reg:SI 26) 0)
(insn 28 27 30 (set (mem/f:SI (reg:SI 26) 0)
(reg:SI 27)) -1 (nil)
(nil))
(nil)
(set (mem/f:SI (reg:SI 26) 0)
(reg:SI 27))
(nil))) 0)
(nil))))
(nil))))
^^^^^ kaboom!
when reg_scan_mark_refs() scans a chain of `queued's, it eventually
calls itself recursively with the next element of the chain. Since
the chain is (nil)-terminated, it crashes.
This patch fixes the problem, but I figure it might be better to just
check for NULL at the beginning of reg_scan_mark_refs(), or to create
a case for QUEUED and handle the end-of-list situation gracefully, so
as to not impact the default case. Opinions? Ok to install?
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@cygnus.com>
* regclass.c (reg_scan_mark_refs): In the default case, do not
recurse if the first argument would be NULL.
Index: gcc/regclass.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/regclass.c,v
retrieving revision 1.95
diff -u -r1.95 regclass.c
--- gcc/regclass.c 2000/04/24 07:48:12 1.95
+++ gcc/regclass.c 2000/05/18 09:40:06
@@ -2322,12 +2322,17 @@
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
if (fmt[i] == 'e')
- reg_scan_mark_refs (XEXP (x, i), insn, note_flag, min_regno);
+ {
+ if (XEXP (x, i))
+ reg_scan_mark_refs (XEXP (x, i), insn, note_flag, min_regno);
+ }
else if (fmt[i] == 'E' && XVEC (x, i) != 0)
{
register int j;
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- reg_scan_mark_refs (XVECEXP (x, i, j), insn, note_flag, min_regno);
+ if (XVECEXP (x, i, j))
+ reg_scan_mark_refs (XVECEXP (x, i, j), insn,
+ note_flag, min_regno);
}
}
}
--
Alexandre Oliva Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org} Write to mailing lists, not to me