[PSEH3] Fix _SEH3_LEAVE

Previously, when leave was used in the except or finally block of a nested try block, it would jump back to the start of the except/finally block, resulting in an endless loop. This is fixed by jumping back to a label at the beginning of the try block, which is only visible from within the try block itself and from there to the end of the SEH block.
Fixes seh0055 testcase of MS SEH tests.
This commit is contained in:
Timo Kreuzer 2020-03-10 15:44:19 +02:00
parent d054f63e68
commit ff8d24cabb
2 changed files with 7 additions and 3 deletions

View file

@ -371,13 +371,18 @@ _Pragma("GCC diagnostic pop") \
volatile SEH3$_REGISTRATION_FRAME _SEH3$_AUTO_CLEANUP _SEH3$_TrylevelFrame; \
\
goto _SEH3$_l_BeforeTry; \
{ \
__label__ _SEH3$_l_Leave; \
_SEH3$_l_Leave: (void)0; \
/* Silence warning */ goto _SEH3$_l_AfterTry; \
/* Silence warning */ goto _SEH3$_l_Leave; \
\
_SEH3$_l_DoTry: \
if (1)
#define _SEH3_EXCEPT(...) \
} \
/* End of the try block */ \
_SEH3$_l_AfterTry: (void)0; \
goto _SEH3$_l_EndTry; \
@ -422,6 +427,7 @@ _Pragma("GCC diagnostic pop") \
#define _SEH3_FINALLY \
} \
/* End of the try block */ \
_SEH3$_l_AfterTry: (void)0; \
/* Set ExceptionPointers to 0, this is used by _abnormal_termination() */ \
@ -471,7 +477,7 @@ _Pragma("GCC diagnostic pop") \
/* Close the outer scope */ \
}
#define _SEH3_LEAVE goto _SEH3$_l_AfterTry
#define _SEH3_LEAVE goto _SEH3$_l_Leave
#define _SEH3_VOLATILE volatile