From b5075450cef2cd29b2ee31a96a8553ae2a444c47 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 13 Dec 1998 00:12:17 +0000 Subject: [PATCH] Conflict resolution. --- gnu/dist/gcc/libgcc2.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/gnu/dist/gcc/libgcc2.c b/gnu/dist/gcc/libgcc2.c index aa2302462119..c378d6e32a32 100644 --- a/gnu/dist/gcc/libgcc2.c +++ b/gnu/dist/gcc/libgcc2.c @@ -3061,10 +3061,6 @@ __empty () #include "eh-common.h" -/* This is a safeguard for dynamic handler chain. */ - -static void *top_elt[2]; - /* Allocate and return a new EH context structure. */ extern void __throw (); @@ -3072,15 +3068,26 @@ extern void __throw (); static void * new_eh_context () { - struct eh_context *eh = (struct eh_context *) malloc (sizeof *eh); - if (! eh) + struct eh_full_context { + struct eh_context c; + void *top_elt[2]; + } *ehfc = (struct eh_full_context *) malloc (sizeof *ehfc); + + if (! ehfc) __terminate (); - memset (eh, 0, sizeof *eh); + memset (ehfc, 0, sizeof *ehfc); - eh->dynamic_handler_chain = top_elt; + ehfc->c.dynamic_handler_chain = (void **) ehfc->top_elt; - return eh; + /* This should optimize out entirely. This should always be true, + but just in case it ever isn't, don't allow bogus code to be + generated. */ + + if ((void*)(&ehfc->c) != (void*)ehfc) + __terminate (); + + return &ehfc->c; } #if __GTHREADS @@ -3277,7 +3284,7 @@ __sjthrow () /* We must call terminate if we try and rethrow an exception, when there is no exception currently active and when there are no handlers left. */ - if (! eh->info || (*dhc) == top_elt) + if (! eh->info || (*dhc)[0] == 0) __terminate (); /* Find the jmpbuf associated with the top element of the dynamic