-
Notifications
You must be signed in to change notification settings - Fork 141
Flang admits non-polymorphic instances of abstract derived types as procedure arguments #874
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
Comments
f18 also does not seem to catch this. |
@kiranchandramohan Feel free to include these samples into both the flang/f18 test suites. |
I get this from f18:
|
Apologies. Thanks for the update @tskeith. |
Given that f18 has been targeting Fortran 2018 from its inception, can we expect Fortran's object-oriented features to be in better shape in f18 than in contemporary compilers (once f18 produces code)? |
@difference-scheme I can make only a general statement here. f18 has been designed on a horizontal basis using Fortran 2018 as a reference. This means that care has been taken to represent all constructs in the standard in each stage. Parsing for Fortran 2018 is complete. Semantic Checks are nearing completion. High Level IR is maturing and making its way into the master branch. The High Level IR (FIR) has explicit representation for dispatch tables which helps with dynamic dispatch (an object-oriented feature). (https://github.com/schweitzpgi/f18/blob/a8a4cf36b59d7442eecd03feca285faad080f445/documentation/FIRLangRef.md#firdispatch) |
Just an FYI: This bug occurs only with empty abstract derived types. If the abstract type is non-empty, Flang issues an error. For example, program test type, abstract :: basic contains subroutine tester(obj) end program test |
@mleair Thanks for pointing this out. |
@kiranchandramohan Thanks for your assessment and the link you provided. This sounds great! I am looking forward to using f18, once it lands in llvm. |
@difference-scheme Just to clarify, I am not saying that there will be full support of object-oriented features when f18 lands in LLVM. It will take some time to get there but the design has considered these features from the ground up. Also, work is ongoing to i) implement and move FIR from a branch to master and ii) runtime. |
@kiranchandramohan I see. Unfortunately, and even if they would be supported as soon as f18 lands in LLVM, Fortran 2018's OO features are sorely lacking. Here is a PR of a proposal to J3 for rectifying this in future standards: j3-fortran/fortran_proposals#143 Would any of the developers here be interested in prototyping such new functionality in f18? I've tried to familiarize myself with the f18 code-base but, unfortunately, I found it very hard to do so. |
I cannot speak for everyone but given that the development of F18 is in progress, I believe the preference would be to get F18 into a fully functional state. Also, to fully prototype this feature I believe F18 should have FIR/MLIR code generation. So I guess this has to wait for some time. |
@kiranchandramohan Thanks for your reply and your suggestions. Your plan for f18 development sounds perfectly reasonable. The features I have in mind do require new syntax. I have tried to understand the f18 parser code, but I couldn't figure out the basic data structures that it relies on. There is some heavy macro usage, and templating going on in the code, along with some C++17 magic that made me conclude that I don't have the necessary background to try and dig any deeper. |
This is related to Issue #873. This, too, is invalid code that should be rejected by the compiler.
The text was updated successfully, but these errors were encountered: