Skip to content
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

[flang][WIP] Refactor ISO_FORTRAN_ENV to move kind arrays to global symbols #89416

Closed

Conversation

mjklemm
Copy link
Contributor

@mjklemm mjklemm commented Apr 19, 2024

This PR resolves issue #89403 by turning the constant implied-shape shape arrays for integer-kinds, real-kinds, and logical_kinds into regular arrays. That way, they can be accessed using variable indexes.

@mjklemm mjklemm self-assigned this Apr 19, 2024
@llvmbot llvmbot added the flang Flang issues not falling into any other category label Apr 19, 2024
@mjklemm
Copy link
Contributor Author

mjklemm commented Apr 19, 2024

This PR is one way to fix the mentioned bug. Not sure if code-gen could/should be adapted to solve this problem in the compiler itself.

One thing thing that I still need to figure out (help appreciated) is how to get the object file of the newly added module linked into FortranRuntime. It might be good to have a general way to do this in case there will be more modules that have an implementation part and thus cannot be translated using -fsyntax-only.

Copy link
Contributor

@klausler klausler left a comment

Choose a reason for hiding this comment

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

The REAL_KINDS exported from ISO_FORTRAN_ENV is not a named constant after this change, right? So it would no longer work in a constant expression or initializer. That seems like a non-starter, if so.

@mjklemm
Copy link
Contributor Author

mjklemm commented Apr 19, 2024

The REAL_KINDS exported from ISO_FORTRAN_ENV is not a named constant after this change, right? So it would no longer work in a constant expression or initializer. That seems like a non-starter, if so.

Hm... You're right. So, this needs to go back to the drawing board... So, this needs to be fixed in code-gen, I guess.

@klausler
Copy link
Contributor

The REAL_KINDS exported from ISO_FORTRAN_ENV is not a named constant after this change, right? So it would no longer work in a constant expression or initializer. That seems like a non-starter, if so.

Hm... You're right. So, this needs to go back to the drawing board... So, this needs to be fixed in code-gen, I guess.

Lowering doesn't seem like the right place, either. What's necessary is compiling the modules into relocatable object files and incorporating them into the runtime support library. The modules need to be compiled with target information in hand, anyway; their contents reflect the build host today.

@mjklemm
Copy link
Contributor Author

mjklemm commented Apr 19, 2024

The modules do not compile right now. For ISO_FORTRAN_ENV, actually compiling the module file resulted in the compiler choking about numeric_storage_size intrinsic not being implemented.

@mjklemm
Copy link
Contributor Author

mjklemm commented Apr 19, 2024

I'll drop this PR. Let's discuss the potential solution over in the issue. That seems more appropriate going forward.

@mjklemm mjklemm closed this Apr 19, 2024
@mjklemm mjklemm deleted the bug89403-iso_fortran_env-kind-arrays branch April 19, 2024 17:34
@mjklemm mjklemm restored the bug89403-iso_fortran_env-kind-arrays branch May 29, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants