Skip to content

Conversation

rouson
Copy link
Collaborator

@rouson rouson commented Sep 28, 2025

fixes #233

Pure functions get_activation_by_name and get_optimizer_by_name construct polymorphic function results. Removing pure enables building with the LLVM flang-new compiler.

Although Fortran 2003 allowed pure functions with allocatable polymorphic results, subsequent standards disallowed such functions. Using this Fortran 2003 feature blocks building with the LLVM and NAG compilers and likely will block building with future versions of gfortran once GCC issue 78640 has been fixed. (See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78640.)

TODO: A subsequent error still blocks building with NAG, which this commit does not address.

fixes modern-fortran#233

Pure functions get_activation_by_name and get_optimizer_by_name
construct polymorphic function results.  Removing `pure` enables
building with the LLVM flang-new compiler.

Although Fortran 2003 allowed pure functions with allocatable
polymorphic results, subsequent standards disallowed such functions.
Using this Fortran 2003 feature blocks building with the LLVM and NAG
compilers and likely will block building with future versions of
gfortran once GCC issue 78640 has been fixed.  (See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78640.)

TODO: A subsequent error still blocks building with NAG, which this
commit does not address.
Copy link
Collaborator

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

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

I introduced this issue in #232 . I wasn't aware of that. Thank you for fixing it

@milancurcic
Copy link
Member

Great, thanks!

@milancurcic milancurcic merged commit 00acae2 into modern-fortran:main Sep 28, 2025
4 checks passed
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.

Build error with LLVM flang-new and NAG nagfor due to standard violation
3 participants