Skip to content

Attributes: replace custom void* union with C union [v5.0.x] #10353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 5, 2022

Conversation

devreal
Copy link
Contributor

@devreal devreal commented May 3, 2022

The current implementation uses a void* to store different types of attribute value integers and attempts to figure out proper offsets for storing smaller integers in that pointer. The required pointer aliasing is UB and causes issues with GCC 11.

The new implementation replaces the self-built pointer-based union with a C union and selects the right field based on the av_set_from value.

This patch also fixes a bug where copied attributes always had the set_from field set to C pointer, which worked but is technically not correct.

Backport of #10344 to v5.0.x
Related #10339

Signed-off-by: Joseph Schuchart [email protected]

devreal and others added 2 commits May 3, 2022 18:08
The current implementation uses a void* to store different types of
attribute value integers and attempts to figure out proper offsets
for storing smaller integers in that pointer. The required pointer
aliasing is UB and causes issues with GCC 11.

The new implementation replaces the self-built pointer-based union
with a C union and selects the (pointer to the) right field based
on the av_set_from value.

This patch also fixes a bug where copied attributes always had the
set_from field set to C pointer, which worked but is technically not
correct.

Signed-off-by: Joseph Schuchart <[email protected]>
(cherry picked from commit fdc7108)
Correct a few minor mistakes in the large comment at the top of
ompi/attribute/attribute.c from when 72cfbb6 added several new
cases to attribute handling.

Signed-off-by: Jeff Squyres <[email protected]>
(cherry picked from commit cce89e8)
@devreal devreal requested review from jsquyres and hjelmn May 3, 2022 22:11
Copy link
Member

@jsquyres jsquyres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed in v4.1.x as well?

@jsquyres jsquyres added this to the v5.0.0 milestone May 4, 2022
@devreal
Copy link
Contributor Author

devreal commented May 5, 2022

Good point, PR for 4.1.x is at #10357. Do we still backport to 4.0.x?

@janjust janjust merged commit 4ed1d8d into open-mpi:v5.0.x May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants