llvm-project/flang/test/Driver/no-duplicate-main.f90
David Truby 8d5386669e
[flang] Generate main only when a Fortran program statement is present (#89938)
This patch changes the behaviour for flang to only create and link to a
`main` entry point when the Fortran code has a program statement in it.

This means that flang-new can be used to link even when the program is
a mixed C/Fortran code with `main` present in C and no entry point
present in Fortran.

This also removes the `-fno-fortran-main` flag as this no longer has any
functionality.
2024-04-29 14:16:25 +01:00

15 lines
466 B
Fortran

! UNSUPPORTED: system-windows, system-darwin, system-aix
! RUN: %flang -x ir -o %t.c-object -c %S/Inputs/no_duplicate_main.ll
! RUN: %flang -o %t -c %s
! RUN: not %flang -o %t.exe %t %t.c-object 2>&1
! TODO: potentially add further checks to ensure that proper
! linker error messages are detected and checked via
! FileCheck.
program main_dupes
! Irrelevant what to do in here.
! Test is supposed to fail at link time.
end program main_dupes