From 83adfaa720ae445084b36aab3ad17532a68870d7 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Sat, 3 Dec 2022 10:47:05 -0800 Subject: [PATCH] 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 for raising this potential concern. --- CHANGES | 9 +++++++++ seed.c | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 84fdd98..722f7a4 100644 --- a/CHANGES +++ b/CHANGES @@ -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 for + raising this potential concern. + The following are the changes from calc version 2.14.1.2 to date: diff --git a/seed.c b/seed.c index 4f1002f..03edac4 100644 --- a/seed.c +++ b/seed.c @@ -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 */