Reduce compiler ability to optimise to statisfy gcc 9.5 #1442
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issues:
P118709392
Description of changes:
This PR is an attempt to fix a transient issue with gcc 9.5 compilation. This is a test workflow, so no hot-path performance regression concerns from me.
gcc 9.5 has a bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189 that has not been backported. Essentially, the compiler will falsely reason that it's comparing a string and optimise out everything behind a null-character.
In the test fixture
SSLVersionTest.DefaultTicketKeyInitialization
it appears the gcc 9.5 compiler only compares the first byte and short-circuits there. What was observed:Dropping
static const
removes optimisation options for the compiler. In my tests, gcc 9.5 now emits a directmemcmp
instead of attempting any optimisations:Testing:
Tested on machines with gcc 9.5 runtime. Before failed, after this patch, no failure (even when forcing first byte to 0).
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.