Removed compiler confusing setjmp() call

In pseudo_seed(), we removed a call to setjmp() that was only
there to add more information to mix into the seed.  For compilers
such as gcc that used -Wclobbered, the call to setjmp() gave the
impression that the hash_val might be clobbered by a longjmp().
Where there is no longjmp() that would use the previous setjmp(),
the gcc compiler has nil ways to notice that. So to avoid confusion
we removed the setjmp() call.  Thanks to <GitHub user mattdm> for
raising this potential concern.
This commit is contained in:
Landon Curt Noll
2022-12-03 10:47:05 -08:00
parent ef6a30c9c9
commit 83adfaa720
2 changed files with 9 additions and 1 deletions

View File

@@ -14,6 +14,15 @@ The following are the changes from calc version 2.14.2.0 to date:
pre-modified copy of fd_setup. We realloc the fd_orig array and copy
the fd_setup into it first, before touching the fd_setup array.
In pseudo_seed(), we removed a call to setjmp() that was only
there to add more information to mix into the seed. For compilers
such as gcc that used -Wclobbered, the call to setjmp() gave the
impression that the hash_val might be clobbered by a longjmp().
Where there is no longjmp() that would use the previous setjmp(),
the gcc compiler has nil ways to notice that. So to avoid confusion
we removed the setjmp() call. Thanks to <GitHub user mattdm> for
raising this potential concern.
The following are the changes from calc version 2.14.1.2 to date:

1
seed.c
View File

@@ -592,7 +592,6 @@ pseudo_seed(void)
sdata.size = sizeof(sdata);
sdata.prev_hash64_copy = prev_hash64; /* load previous hash */
sdata.call_count_copy = ++call_count; /* update call count */
(void) setjmp(sdata.env);
#if defined(HAVE_ENVIRON)
sdata.environ_copy = environ;
#endif /* HAVE_ENVIRON */