Work around a GNU Fortran bug regarding unlimited polymorphic entities#366
Merged
kuanchihwang merged 6 commits intoESCOMP:developmentfrom Mar 4, 2025
Conversation
Part 1 of 2 for MPAS dynamical core. Workaround for a bug in GNU Fortran >= 12. This is perhaps the manifestation of GCC Bugzilla Bug 100819. When a character string array is passed as the actual argument to an unlimited polymorphic dummy argument, its array index and length parameter are mishandled.
Part 2 of 2 for CAM-SIMA. Workaround for a bug in GNU Fortran >= 12. This is perhaps the manifestation of GCC Bugzilla Bug 100819. When a character string array is passed as the actual argument to an unlimited polymorphic dummy argument, its array index and length parameter are mishandled.
Also, avoid exceeding the line length limit of 132 characters.
GitHub documentation strongly recommends that actions should use variables to access the filesystem rather than using hard-coded paths.
mwaxmonsky
approved these changes
Feb 28, 2025
Collaborator
mwaxmonsky
left a comment
There was a problem hiding this comment.
Just a quick question but otherwise all looks great!
| run: | | ||
| cmake \ | ||
| -DCMAKE_PREFIX_PATH=/home/runner/work/CAM-SIMA/CAM-SIMA/pFUnit/build/installed \ | ||
| -DCMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/pFUnit/build/installed \ |
nusbaume
requested changes
Mar 4, 2025
Collaborator
nusbaume
left a comment
There was a problem hiding this comment.
Thanks for the fix @kuanchihwang! My only request is to, at least for now, revert back to the len=* syntax in the pFUnit code, as that matches much of the rest of CAM-SIMA and atmospheric_physics (although long-term I am happy to have more discussion on what the ideal Fortran style should be for SIMA as whole).
nusbaume
approved these changes
Mar 4, 2025
Collaborator
nusbaume
left a comment
There was a problem hiding this comment.
Everything looks great to me now. Thanks again @kuanchihwang!
Collaborator
|
@kuanchihwang Also feel free to merge this in whenever you are ready, as it would probably be best for this PR to come in next. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Tag name (required for release branches):
None
Originator(s):
kuanchihwang
Descriptions (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number):
The
stringifyutility function uses an advanced Fortran language feature: Polymorphism. Unfortunately, recent GNU Fortran versions (>= 12) have problems with it. When a character string array is passed as the actual argument to an unlimited polymorphic dummy argument, its array index and length parameter are mishandled.This compiler bug is perhaps the manifestation of GCC Bugzilla Bug 100819. A workaround, which is implemented by this PR, is to use a temporary character string array. As a result, the unit tests no longer need to be guarded by the
__GNUC__macro.Additionally, this PR also harmonizes the code style in unit tests.
Describe any changes made to the build system:
None
Describe any changes made to the namelist:
None
List any changes to the defaults for the input datasets (e.g., boundary datasets):
None
List all files eliminated and why:
None
List all files added and what they do:
None
List all existing files that have been modified, and describe the changes:
M .github/workflows/fortran_unit_tests.ymlM src/core_utils/string_core_utils.F90M src/dynamics/mpas/driver/dyn_mpas_subdriver.F90M test/unit/fortran/src/core_utils/test_string_core_utils.pfRegression tests:
No changes to any existing tests with respect to the last baseline,
sima0_03_000.