diff --git a/fortran/common/consts.F90 b/fortran/common/consts.F90 index 575ddca690..d32901376d 100644 --- a/fortran/common/consts.F90 +++ b/fortran/common/consts.F90 @@ -8,7 +8,7 @@ module consts_mod ! ! Started: July 2020 ! -! Last Modified: Wednesday, April 10, 2024 AM01:55:03 +! Last Modified: Wednesday, April 10, 2024 PM09:18:10 !--------------------------------------------------------------------------------------------------! !--------------------------------------------------------------------------------------------------! @@ -158,7 +158,7 @@ module consts_mod ! N.B.: The `if` is a workaround for the following issues with LLVM flang 19.0.0 and nvfortran 24.3.0: ! https://fortran-lang.discourse.group/t/flang-new-19-0-warning-overflow-on-power-with-integer-exponent/7801 ! https://forums.developer.nvidia.com/t/bug-of-nvfortran-24-3-0-fort1-terminated-by-signal-11/289026 -#if (defined __llvm__ && defined __flang__) +#if (defined __flang__ && __flang_major__ <= 19) real(RP), parameter :: TINYCV = TEN**max(-60.0, -real(MAXPOW10)) #else real(RP), parameter :: TINYCV = TEN**max(-60, -MAXPOW10) diff --git a/matlab/mex_gateways/tests/makefiles/Makefile.common b/matlab/mex_gateways/tests/makefiles/Makefile.common index cfd5cc0769..a0fc05d54d 100644 --- a/matlab/mex_gateways/tests/makefiles/Makefile.common +++ b/matlab/mex_gateways/tests/makefiles/Makefile.common @@ -4,7 +4,7 @@ # 9: G95 # a: Absoft af95 # d: AOCC flang -# f: Classic flang +# f: LLVM flang # g: GNU gfortran # n: NAG nagfor # i: Intel ifort @@ -251,10 +251,13 @@ dtest_i2_r16_d1_tst dtest_i4_r16_d1_tst dtest_i8_r16_d1_tst dtest_i2_r16_d0_tst dtest_i2_r16_d1_tst dtest_i4_r16_d1_tst dtest_i8_r16_d1_tst dtest_i2_r16_d0_tst dtest_i4_r16_d0_tst dtest_i8_r16_d0_tst: \ FC2 := $(DFORT) $(FFLAGS2) -ffp-exception-behavior=strict -# Classic Flang -FFORT := flang -FFORT := $(FFORT) -pedantic-errors -Werror -FFORT := $(FFORT) -std=f$(FSTD) -pedantic -Weverything -Wall -Wextra -Minform=warn -Mstandard -Mbounds -Mchkptr -Kieee +# LLVM Flang +FFORT := $(shell find -L /usr/bin /usr/local/bin ${HOME}/local ${HOME}/.local /tmp -type f -executable -name flang -print 2>/dev/null | sort | tail -n 1) +FFINC := $(shell dirname $$(dirname $(FFORT) 2>/dev/null) 2>/dev/null)/include +FFLIB := $(shell dirname $$(dirname $(FFORT) 2>/dev/null) 2>/dev/null)/lib +FFORT := $(FFORT) -fimplicit-none -Werror +# -std or -pedantic does not work due to the non-standard code in the MEX API provided by MathWorks +#FFORT := $(FFORT) -std=f2018 -pedantic ftest_i2_r4_d1_tst ftest_i4_r4_d1_tst ftest_i8_r4_d1_tst ftest_i2_r4_d0_tst ftest_i4_r4_d0_tst ftest_i8_r4_d0_tst: \ FC1 := $(FFORT) $(FFLAGS1)