This is an archive of the discontinued LLVM Phabricator instance.

[flang] Add a wrapper for Fortran main program
AbandonedPublic

Authored by jeanPerier on Sep 30 2021, 10:03 AM.

Details

Summary

Add a C wrapper that calls the Fortran runtime initialization and
finalization routines as well as the compiled Fortran main program
_QQmain.

Place it in its own library to satisfy shared library builds since it
contains a C main function.

Event Timeline

jeanPerier created this revision.Sep 30 2021, 10:03 AM
jeanPerier requested review of this revision.Sep 30 2021, 10:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 30 2021, 10:03 AM

The main program looks okay to me. I can't comment on the cmake mysteries.

clementval added inline comments.Sep 30 2021, 1:14 PM
flang/runtime/Fortran_main.c
2

Do we need a LLVM header in this file?

klausler added inline comments.Sep 30 2021, 1:16 PM
flang/runtime/Fortran_main.c
2

Which LLVM headers do you have in mind?

jeanPerier added inline comments.Sep 30 2021, 2:25 PM
flang/runtime/Fortran_main.c
2

Ah, good catch, I guess it needs the #===-- licence header...

clementval added inline comments.Oct 1 2021, 12:10 AM
flang/runtime/Fortran_main.c
2

Yah I was thinking about the licence header (with the comments).

Added LLVM licence to Fortran_main.c

This revision is now accepted and ready to land.Oct 1 2021, 12:23 AM

Does anyone knows why build bots are not running on this patch (only arc lint + unit seems to be done) ?

I pushed the change by accident (arc patched another approved patch on the wrong branch....) and reverted it, but in the meantime I got some windows failure with this patch:

0.181 [141/5/1] Building C object tools\flang\runtime\CMakeFiles\obj.Fortran_main.dir\Fortran_main.c.obj
FAILED: tools/flang/runtime/CMakeFiles/obj.Fortran_main.dir/Fortran_main.c.obj 
C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe [...] flang\runtime\Fortran_main.c
C:\Users\buildbot-worker\minipc-ryzen-win\flang-x86_64-windows\llvm-project\flang\include\flang/Runtime/stop.h(30): error C2143: syntax error: missing ')' before '='
C:\Users\buildbot-worker\minipc-ryzen-win\flang-x86_64-windows\llvm-project\flang\include\flang/Runtime/stop.h(30): warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
C:\Users\buildbot-worker\minipc-ryzen-win\flang-x86_64-windows\llvm-project\flang\include\flang/Runtime/stop.h(30): error C2072: '_FortranAExit': initialization of a function
C:\Users\buildbot-worker\minipc-ryzen-win\flang-x86_64-windows\llvm-project\flang\include\flang/Runtime/stop.h(30): error C2059: syntax error: ')'

So I am wondering how I can make sure I do not break windows here when I find a fix for this.

Does anyone knows why build bots are not running on this patch (only arc lint + unit seems to be done) ?

I pushed the change by accident (arc patched another approved patch on the wrong branch....) and reverted it, but in the meantime I got some windows failure with this patch:

0.181 [141/5/1] Building C object tools\flang\runtime\CMakeFiles\obj.Fortran_main.dir\Fortran_main.c.obj
FAILED: tools/flang/runtime/CMakeFiles/obj.Fortran_main.dir/Fortran_main.c.obj 
C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe [...] flang\runtime\Fortran_main.c
C:\Users\buildbot-worker\minipc-ryzen-win\flang-x86_64-windows\llvm-project\flang\include\flang/Runtime/stop.h(30): error C2143: syntax error: missing ')' before '='
C:\Users\buildbot-worker\minipc-ryzen-win\flang-x86_64-windows\llvm-project\flang\include\flang/Runtime/stop.h(30): warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
C:\Users\buildbot-worker\minipc-ryzen-win\flang-x86_64-windows\llvm-project\flang\include\flang/Runtime/stop.h(30): error C2072: '_FortranAExit': initialization of a function
C:\Users\buildbot-worker\minipc-ryzen-win\flang-x86_64-windows\llvm-project\flang\include\flang/Runtime/stop.h(30): error C2059: syntax error: ')'

So I am wondering how I can make sure I do not break windows here when I find a fix for this.

Might be a config issue. Maybe the path flang/runtime does not trigger a build.

schweitz accepted this revision.Oct 1 2021, 12:36 PM
jeanPerier abandoned this revision.Jul 27 2022, 5:39 AM

Was added in a better way in https://reviews.llvm.org/D122008.

Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2022, 5:39 AM