Skip to content

Commit

Permalink
FIXED: Avoid corruption in setjmp()/longjmp()
Browse files Browse the repository at this point in the history
Clang demands using a volatile variable for protecting the throw
environment's parent.  This is probably correct, although it seems
weird to place this variable in a register.
  • Loading branch information
JanWielemaker committed Oct 22, 2024
1 parent 530b2d4 commit 06ad6af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pl-incl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1800,8 +1800,8 @@ stack overflow.
#define THROW_MAGIC 42424242

typedef struct exception_frame /* PL_throw exception environments */
{ struct exception_frame *parent; /* parent frame */
int magic; /* THROW_MAGIC */
{ struct exception_frame * volatile parent; /* parent frame */
volatile int magic; /* THROW_MAGIC */
jmp_buf exception_jmp_env; /* longjmp environment */
} exception_frame;

Expand Down

0 comments on commit 06ad6af

Please sign in to comment.