It seems, flang can now be build by clang4.0 . So I would vote for a change within the devel/flang and devel/flang-clang ports.
Created attachment 184474 [details]
patch updates devel/flang-clang from version 3.9 to 4.0
Created attachment 184475 [details]
patch updates devel/flang from version 3.9 to 4.0
These two patches build and install fine, but have problems to run, at least on recent HEAD amd64.
It turns out, that run time problems only occur, if flang is called without a fortran source file, i.e.
/usr/local/flang/lib/libflangmain.a(flangmain.c.o): In function `main':
/usr/ports/devel/flang/work/flang-cd44bcd/runtime/flangmain/flangmain.c:(.text.main+0x39): undefined reference to `MAIN_'
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
Compiling something like 'flang hello.f90' gives an executable a.out, as expected:
So I think, the updated version 4.0 should be usable in princible.
Thanks for the patches! I'll try to test them these days and will then commit them to the port unless something comes up.
A commit references this bug:
Date: Mon Jul 31 02:33:10 UTC 2017
New revision: 446946
devel/flang and devel/flang-clang: Update to snapshots supporting llvm 4.0 and upgrade dependencies to this version.
Submitted by: Rainer Hurling (firstname.lastname@example.org)
Reviewed by: swills (mentor)
Approved by: swills (mentor)
Differential Revision: https://reviews.freebsd.org/D11709
Committed in r446946. Thanks again!