Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 192be6d

Browse files
authored
[release/3.1] Fix FC_NO_TAILCALL with newer compilers (#28132)
The C11 standard treats trivial infinite loops as undefined behavior and allows compilers to optimize them out completely. Add "volatile" on FC_NO_TAILCALL to defeat this optimization
1 parent 76c56ac commit 192be6d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/vm/ecall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void ECall::PopulateManagedStringConstructors()
146146
static CrstStatic gFCallLock;
147147

148148
// This variable is used to force the compiler not to tailcall a function.
149-
int FC_NO_TAILCALL;
149+
RAW_KEYWORD(volatile) int FC_NO_TAILCALL;
150150

151151
#endif // !DACCESS_COMPILE
152152

src/vm/fcall.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ void HCallAssert(void*& cache, void* target);
928928
// might do, which would otherwise confuse the epilog walker.
929929
//
930930
// * See #FC_INNER for more
931-
extern int FC_NO_TAILCALL;
931+
extern RAW_KEYWORD(volatile) int FC_NO_TAILCALL;
932932
#define FC_INNER_RETURN(type, expr) \
933933
type __retVal = expr; \
934934
while (0 == FC_NO_TAILCALL) { }; /* side effect the compile can't remove */ \

0 commit comments

Comments
 (0)