This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
segfault in init_elim_table
- To: egcs-patches at cygnus dot com
- Subject: segfault in init_elim_table
- From: Nathan Sidwell <nathan at acm dot org>
- Date: Mon, 07 Dec 1998 17:13:37 +0000
- Organization: Computer Science Dept, Bristol University
hi,
I had a seg fault in init_elim_table
(http://www.cygnus.com/ml/egcs-bugs/1998-Dec/0105.html). What confuses
me about Jeff's response is why are we trying to eliminate registers, if
we're not compiling any code?
If we don't need to eliminate regs when we're not emitting code, then
why not just check current_function_decl on entry to eliminate_regs, and
bail out if it's NULL?
Attached is a patch which does just that.
nathan
--
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
You can up the bandwidth, but you can't up the speed of light
nathan@acm.org http://www.cs.bris.ac.uk/~nathan/ nathan@cs.bris.ac.uk
gcc/ChangeLog
Mon Dec 7 16:55:52 BST 1998 Nathan Sidwell <nathan@acm.org>
* reload1.c (eliminate_regs): Don't do anything, if we're not
generating code.
Index: egcs/gcc/reload1.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/reload1.c,v
retrieving revision 1.107
diff -c -3 -p -r1.107 reload1.c
*** reload1.c 1998/12/01 14:36:51 1.107
--- reload1.c 1998/12/07 16:07:32
*************** eliminate_regs (x, mem_mode, insn)
*** 2651,2661 ****
char *fmt;
int copied = 0;
! /* We can reach here without reload being run if we have an variable
! definition in a file with no functions (for exmaple). Ensure we
! have a valid elimination table in such cases. */
! if (reg_eliminate == NULL)
! init_elim_table ();
switch (code)
{
--- 2651,2658 ----
char *fmt;
int copied = 0;
! if (! current_function_decl)
! return x;
switch (code)
{