summaryrefslogtreecommitdiff
path: root/gnu/egcs
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2011-12-15 20:07:37 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2011-12-15 20:07:37 +0000
commit90010d9049b9f35ef96b34f8fa06551fc6cbd8dd (patch)
treee911e89935c34eab7d14aa8a91041899f1497684 /gnu/egcs
parent9d0b73e44d12abd9daf1e3ef6244d20ab28f0af2 (diff)
In duplicate_decls(), don't try to take advantage of the ``permanent_obstack''
memory usage optimization, because this code is just bogus and causes access-beyond-allocated-size SIGSEGV in the wild. This is part of a larger diff (being worked on) backporting the removal of ``permanent_obstack'' completely from gcc, as done by the gcc folks in 3.x after they came to their senses (or got tired of dissecting coredumps on platforms with strong malloc implementations). Only affects m68k, m88k and vax; collecting dust in the m88k tree, commit triggered by sebastia@ via espie@ as this fixes the devel/gperf port on vax.
Diffstat (limited to 'gnu/egcs')
-rw-r--r--gnu/egcs/gcc/cp/decl.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/gnu/egcs/gcc/cp/decl.c b/gnu/egcs/gcc/cp/decl.c
index b7e19b3fccc..d1f356e0387 100644
--- a/gnu/egcs/gcc/cp/decl.c
+++ b/gnu/egcs/gcc/cp/decl.c
@@ -3152,7 +3152,6 @@ int
duplicate_decls (newdecl, olddecl)
tree newdecl, olddecl;
{
- extern struct obstack permanent_obstack;
unsigned olddecl_uid = DECL_UID (olddecl);
int olddecl_friend = 0, types_match = 0;
int new_defines_function = 0;
@@ -3725,8 +3724,6 @@ duplicate_decls (newdecl, olddecl)
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
int function_size;
- struct lang_decl *ol = DECL_LANG_SPECIFIC (olddecl);
- struct lang_decl *nl = DECL_LANG_SPECIFIC (newdecl);
function_size = sizeof (struct tree_decl);
@@ -3734,11 +3731,6 @@ duplicate_decls (newdecl, olddecl)
(char *) olddecl + sizeof (struct tree_common),
function_size - sizeof (struct tree_common));
- /* Can we safely free the storage used by newdecl? */
-
-#define ROUND(x) ((x + obstack_alignment_mask (&permanent_obstack)) \
- & ~ obstack_alignment_mask (&permanent_obstack))
-
if (DECL_TEMPLATE_INSTANTIATION (newdecl))
{
/* If newdecl is a template instantiation, it is possible that
@@ -3771,38 +3763,6 @@ duplicate_decls (newdecl, olddecl)
TREE_VALUE (decls) = olddecl;
}
- if (((char *)newdecl + ROUND (function_size) == (char *)nl
- && ((char *)newdecl + ROUND (function_size)
- + ROUND (sizeof (struct lang_decl))
- == obstack_next_free (&permanent_obstack)))
- || ((char *)newdecl + ROUND (function_size)
- == obstack_next_free (&permanent_obstack)))
- {
- DECL_MAIN_VARIANT (newdecl) = olddecl;
- DECL_LANG_SPECIFIC (olddecl) = ol;
- bcopy ((char *)nl, (char *)ol, sizeof (struct lang_decl));
-
- obstack_free (&permanent_obstack, newdecl);
- }
- else if (LANG_DECL_PERMANENT (ol) && ol != nl)
- {
- if (DECL_MAIN_VARIANT (olddecl) == olddecl)
- {
- /* Save these lang_decls that would otherwise be lost. */
- extern tree free_lang_decl_chain;
- tree free_lang_decl = (tree) ol;
-
- if (DECL_LANG_SPECIFIC (olddecl) == ol)
- abort ();
-
- TREE_CHAIN (free_lang_decl) = free_lang_decl_chain;
- free_lang_decl_chain = free_lang_decl;
- }
- else
- {
- /* Storage leak. */;
- }
- }
}
else
{