Testing: Set MALLOC_PERTURB_ to 1 #1492
Merged
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.
The MALLOC_PERTURB_ parameter was used to initialize allocated arrays to
unphysical values. Previously, we had set this to 256 which would
initialize bytes to 0xff, and indirectly set all floats to NaN.
However, MALLOC_PERTURB_ was undocumnted for values greater than 255,
and we were relying on undefined behavior. In newer versions of glibc,
a value of 256 does nothing and is equivalent to a value of 0.
This patch changes the MALLOC_PERTURB_ value to 1, which sets bytes to
0xfe and tends to initialize them to an unphysically large value.
Unfortunately we have temporarily lost the ability to initialize to NaN,
but for now this is probably the best we can do.
(Note that other compilers like Intel can explicitly initialize
allocatables to NaN, so this update is more specific to the GCC
configuration of our GitHub Actions setup than the test suite.)