[flang] [clang] [flang][Driver] Let the linker fail on multiple definitions of main() (PR #73124)

Michael Klemm via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 1 09:56:48 PST 2023


mjklemm wrote:

> That example is different because you used `program` in the fortran source. The use case here is applications which implement `main` in C then call into fortran code

Do you have a link line for ifort?  It seems that your example fails with ifort, but indeed works with gfortran.  The simple reason is that gfortran emits a main function into the translation unit if it has a program unit.  If it does not, the main function is not generated.

https://github.com/llvm/llvm-project/pull/73124


More information about the cfe-commits mailing list