Skip to content

Conversation

@VincentVanlaer
Copy link
Member

This means that the function will never return to its caller. This makes life easier for the optimizer and can prevent spurious maybe-uninitialized warnings.

This change was triggered by warnings in the mtx module about potentially uninitialized variables after allocation. mesa_error was used to terminate MESA if allocate would fail. Inspection of the intermediate representation of GCC showed that it considered execution to continue after mesa_error, which muddied the control flow blocks. To actually trigger a spurious warning, the variable needs to have rank > 1, be declared with pointer, and have unknown size at compile time. This is quite niche, but future changes to warnings & optimizations might change this. At least adding this attribute may make the generated assembly smaller (this was the case for a simple test function).

ifort does not seem to have a similar attribute.

Note: this is a retake of #708, now that the latest SDK is required. The change removes ~40 maybe uninitialized variable warnings

This means that the function will never return to its caller. This makes
life easier for the optimizer and can prevent spurious
maybe-uninitialized warnings.

This change was triggered by warnings in the mtx module about
potentially uninitialized variables after allocation. mesa_error was
used to terminate MESA if allocate would fail. Inspection of the
intermediate representation of GCC showed that it considered execution
to continue after mesa_error, which muddied the control flow blocks. To
actually trigger a spurious warning, the variable needs to have rank >
1, be declared with pointer, and have unknown size at compile time. This
is quite niche, but future changes to warnings & optimizations might
change this. At least adding this attribute may make the generated
assembly smaller (this was the case for a simple test function).

ifort does not seem to have a similar attribute.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants