-
Notifications
You must be signed in to change notification settings - Fork 137
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
Fix clasic flang compilation with in-tree flang #1378
Fix clasic flang compilation with in-tree flang #1378
Conversation
A few quick initial comments.
|
Hi @bryanpkc , thanks for your comments! To address 1 and 3, I will burst my PR into 13 separate PRs. I ask you to kindly review and merge all of them that are not yet covered by a PR merged from your side. Plans and progress are great, but too uncertain due to the corporate security policies regarding opensource contributions. Then you can rebase your changes on top of my merges and cover all the rest. I think this approach is fair, and will help all of us to have greater motivation and faster progress in getting better Flang. |
Here is my logic in simple statements. Kindly please point me to the wrong statement in it:
Therefore, I choose to deploy in-tree LLVM Flang. What is wrong with my logic? |
The Classic Flang compiler is written in C/C++; a pre-existing Fortran compiler is not needed. The Classic Flang runtime contains some Fortran files, but by design they are compiled with the Classic Flang compiler that has just been built. As you can see in our CI workflows, the Classic Flang build does not require any pre-existing Fortran compiler. |
Can you show me your attempt to follow our build instructions (what commands you tried and what they produced)? We can try to help you figure out how to build Classic Flang properly. |
Hi @bryanpkc , I can follow your CI process by pulling one of containers being used for GitHub workflow:
As you can see above, the CI container has the in-tree LLVM Flang built and installed. Next step: in build_flang.sh you have:
which clearly refers to the previously mentioned Flang. From this I conclude the CI uses in-tree Flang to compile the classic Flang.
Therefore this is not true. Could you please ask someone who wrote this CI to come here and explain to us what is going on. |
Some single-bit bitfields are declared as int, and Clang 16 now emits warnings for such uses, e.g. .../flang1exe/commopt.c:389:23: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 Such bitfields should be declared unsigned instead.
…Therefore, we can't use modern C preprocessor features, such as catenation or stringizing
… string and resolve the overflow warning
… that for someone the order of arguments takes precedence over this obvious requirement
…ilers requirements. Do not duplicate eq and == , ne and /= operators definitions, as they seem to be already aliases of each other, and compilers are not happy if we try to overdefine this fact
baa218a
to
9334913
Compare
@dmikushin When
If you invoke this
You can consult the page (https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html) for the Compiler IDs. You can see that Classic Flang uses the |
Hi @kiranchandramohan , thank you for explaining this. Since classic Flang is in the CI image, does your explanation still mean that classic Flang is used to compile the classic Flang itself? |
Clang is used to build the Classic Flang frontend, and the newly built Classic Flang frontend is used to build the Classic Flang runtime libraries. The compiler in the Docker container saves us from rebuilding Clang from source for every Classic Flang pull request; the build process doesn't depend on the Fortran frontend inside the Docker container.
Actually, this clearly refers to the newly built frontend ( |
Thank you both, I've finally sorted out with the compilation. @bryanpkc , I propose to add the following paragraph to the Wiki page to describe the proper build process to avoid any further confusion:
If you agree, please add it to the Wiki page. |
Hello @bryanpkc , I'm waiting for the clarification above to be added to the Wiki page to close this PR. I can't edit the Wiki myself. |
I am supportive of improvements to the Wiki page. Particularly, clarifying the relation with llvm/flang. I have made a couple of edits. I am not sure of a verbatim copy of the writeup that @dmikushin provided. Some of the material is already present on the wiki page, like the dependency on the classic-flang-llvm-project and that it supports additional flags etc. Going too much into the internals (existence of flang1, flang2, Mreentrant flag etc) is probably not required for people who might just want to build the project. |
@kiranchandramohan , I think one critical misunderstanding the current Wiki page still creates is that there should exist some Fortran compiler, prior to the build of Flang. By reading the updated text I would still make the same mistake. My detail about flang1 and flang2 is proposed to emphasize the fact that initially we only enable support for Fortran compiler in LLVM, and that |
Hi @dmikushin, I have edited the Building Flang wiki page again. Is this more understandable? |
This PR will not be accepted as-is; closing. |
This set of patches fixes various issues spotted during compilation of flang-classic with clang and LLVM in-tree flang.
For C/C++ it addresses #1374 and #1375 and fixes fatal clang issues, such as mismatching function pointer signature.
For Fortran it mostly adds a lot of
intent(in)
attributes.