Skip to content

Commit

Permalink
[interp] Fix compiler issue
Browse files Browse the repository at this point in the history
We use the address of this label during EH to resume to it. For whatever reason, with some compilers, if the label is followed by a void return, the address of the label is at the end of the method, so we can't resume to it because it points to foreign code. We return NULL to workaround this.
  • Loading branch information
BrzVlad committed Jan 5, 2021
1 parent 5e18281 commit 3b7d7c3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mono/mini/interp/interp.c
Expand Up @@ -1497,7 +1497,7 @@ interp_to_native_trampoline (gpointer addr, gpointer ccontext)
#ifdef _MSC_VER
#pragma optimize ("", off)
#endif
static MONO_NO_OPTIMIZATION MONO_NEVER_INLINE void
static MONO_NO_OPTIMIZATION MONO_NEVER_INLINE gpointer
ves_pinvoke_method (
InterpMethod *imethod,
MonoMethodSignature *sig,
Expand Down Expand Up @@ -1595,7 +1595,7 @@ ves_pinvoke_method (
#endif
goto exit_pinvoke; // prevent unused label warning in some configurations
exit_pinvoke:
return;
return NULL;
}
#ifdef _MSC_VER
#pragma optimize ("", on)
Expand Down Expand Up @@ -2122,7 +2122,7 @@ do_icall (MonoMethodSignature *sig, int op, stackval *sp, gpointer ptr, gboolean
#pragma optimize ("", off)
#endif
// Do not inline in case order of frame addresses matters, and maybe other reasons.
static MONO_NO_OPTIMIZATION MONO_NEVER_INLINE void
static MONO_NO_OPTIMIZATION MONO_NEVER_INLINE gpointer
do_icall_wrapper (InterpFrame *frame, MonoMethodSignature *sig, int op, stackval *sp, gpointer ptr, gboolean save_last_error)
{
MonoLMFExt ext;
Expand All @@ -2134,7 +2134,7 @@ do_icall_wrapper (InterpFrame *frame, MonoMethodSignature *sig, int op, stackval

goto exit_icall; // prevent unused label warning in some configurations
exit_icall:
return;
return NULL;
}
#ifdef _MSC_VER
#pragma optimize ("", on)
Expand Down

0 comments on commit 3b7d7c3

Please sign in to comment.