This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Avoid emitting invalid stabs
- To: gcc-patches at gcc dot gnu dot org
- Subject: [PATCH] Avoid emitting invalid stabs
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Fri, 20 Jul 2001 14:27:08 +0200
- Cc: hjl at gnu dot org
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
Hi!
See http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=49214 for test
source and invalid .stabs line generated by it.
It turns out that in some cases DECL_RTL of a variable-length array will
have a pseudo, not hard register in it at dbxout_symbol_location.
I think dbxout_symbol_location should prevent dereferencing memory beyond
end of svr4_dbx_register_map array.
As for when this happens, it seems to be cse which replaces in canon_reg
pseudo 92 with oldest equivalent (%esp), but DECL_RTL
(mem/s:BLK (reg:SI 92) 0)
of the buf array is not updated at CSE time. Any ideas what if anything
should CSE do here?
Anyway, ok to commit this?
2001-07-20 Jakub Jelinek <jakub@redhat.com>
* dbxout.c (dbxout_symbol_location): Avoid emitting invalid register
numbers.
--- gcc/dbxout.c.jj Tue Jul 10 00:51:13 2001
+++ gcc/dbxout.c Fri Jul 20 14:03:31 2001
@@ -2129,6 +2129,8 @@ dbxout_symbol_location (decl, type, suff
{
letter = 'r';
current_sym_code = N_RSYM;
+ if (REGNO (XEXP (home, 0)) >= FIRST_PSEUDO_REGISTER)
+ return 0;
current_sym_value = DBX_REGISTER_NUMBER (REGNO (XEXP (home, 0)));
}
else
Jakub