This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
labels-2.c / -Os fix
- To: egcs-patches at egcs dot cygnus dot com, rth at cygnus dot com
- Subject: labels-2.c / -Os fix
- From: Jan Hubicka <hubicka at atrey dot karlin dot mff dot cuni dot cz>
- Date: Wed, 26 Apr 2000 17:37:51 +0200
Hi
The -Os failure at labels-2.c is caused by storing rtx containing LABEL_REF
into const pool. Record_constant expect SYMBOL_REF expression as address
and copies the symbol name, that is not present in LABEL_REF. I am not
sure, how to handle label_refs correctly, so I am making them all to
appear different. This is safe and don't hurt much IMO.
Honza
Wed Apr 26 17:35:06 MET DST 2000 Jan Hubicka <jh@suse.cz>
* varasm.c (record_constant_1): Do not crash on LABEL_REF
addresses.
Index: egcs/gcc//varasm.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/varasm.c,v
retrieving revision 1.111
diff -c -3 -p -r1.111 varasm.c
*** varasm.c 2000/04/15 15:44:19 1.111
--- varasm.c 2000/04/26 15:33:01
*************** record_constant_1 (exp)
*** 2868,2875 ****
obstack_grow (&permanent_obstack,
(char *) &value.offset, sizeof value.offset);
/* Record the symbol name. */
! obstack_grow (&permanent_obstack, XSTR (value.base, 0),
! strlen (XSTR (value.base, 0)) + 1);
}
return;
--- 2868,2887 ----
obstack_grow (&permanent_obstack,
(char *) &value.offset, sizeof value.offset);
/* Record the symbol name. */
! if (GET_CODE (value.base) == SYMBOL_REF)
! obstack_grow (&permanent_obstack, XSTR (value.base, 0),
! strlen (XSTR (value.base, 0)) + 1);
! /* I am not sure how to handle label_refs here. Since their
! labels may not be emited at the moment, we often get 0 as
! an address. It seems to be safe to make all these labels
! appear different. */
! else
! {
! static int counter;
! counter++;
! obstack_grow (&permanent_obstack, &counter,
! sizeof(counter));
! }
}
return;