Skip to content

Commit efc53b6

Browse files
authored
Merge pull request #2665 from martin-frbg/flang-fixes-2a
Fix spelling of flang option -Mrecursive, add -Kieee and workaround for AOCC optimizer bug
2 parents 7288849 + 6876221 commit efc53b6

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

Makefile.system

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,15 @@ endif
783783

784784
ifeq ($(F_COMPILER), FLANG)
785785
CCOMMON_OPT += -DF_INTERFACE_FLANG
786-
FCOMMON_OPT += -frecursive
786+
FCOMMON_OPT += -Mrecursive -Kieee
787+
ifeq ($(OSNAME), Linux)
788+
ifeq ($(ARCH), x86_64)
789+
FLANG_VENDOR := $(shell expr `$(FC) --version|cut -f 1 -d "."|head -1`)
790+
ifeq ($(FLANG_VENDOR),AOCC)
791+
FCOMMON_OPT += -fno-unroll-loops
792+
endif
793+
endif
794+
endif
787795
ifdef BINARY64
788796
ifdef INTERFACE64
789797
ifneq ($(INTERFACE64), 0)
@@ -797,11 +805,6 @@ endif
797805
ifeq ($(USE_OPENMP), 1)
798806
FCOMMON_OPT += -fopenmp
799807
endif
800-
#ifeq ($(OSNAME), Linux)
801-
#ifeq ($(ARCH), x86_64)
802-
#FLANG_VENDOR := $(shell expr `$(FC) --version|cut -f 1 -d "."|head -1`)
803-
#endif
804-
#endif
805808
endif
806809

807810
ifeq ($(F_COMPILER), G77)
@@ -1276,12 +1279,7 @@ endif
12761279

12771280
override CFLAGS += $(COMMON_OPT) $(CCOMMON_OPT) -I$(TOPDIR)
12781281
override PFLAGS += $(COMMON_OPT) $(CCOMMON_OPT) -I$(TOPDIR) -DPROFILE $(COMMON_PROF)
1279-
#ifeq ($(FLANG_VENDOR),AOCC)
1280-
ifeq ($(F_COMPILER),FLANG)
1281-
override FFLAGS += $(filter-out -O2 -O3,$(COMMON_OPT)) -O1 $(FCOMMON_OPT)
1282-
else
12831282
override FFLAGS += $(COMMON_OPT) $(FCOMMON_OPT)
1284-
endif
12851283
override FPFLAGS += $(FCOMMON_OPT) $(COMMON_PROF)
12861284
#MAKEOVERRIDES =
12871285

cmake/fc.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if (${F_COMPILER} STREQUAL "FLANG")
1616
if (USE_OPENMP)
1717
set(FCOMMON_OPT "${FCOMMON_OPT} -fopenmp")
1818
endif ()
19-
set(FCOMMON_OPT "${FCOMMON_OPT} -frecursive")
19+
set(FCOMMON_OPT "${FCOMMON_OPT} -Mrecursive -Kieee")
2020
endif ()
2121

2222
if (${F_COMPILER} STREQUAL "G77")

cmake/system.cmake

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,9 @@ endif ()
419419

420420
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
421421
if ("${F_COMPILER}" STREQUAL "FLANG")
422-
set(FILTER_FLAGS "-O2;-O3")
423-
foreach (FILTER_FLAG ${FILTER_FLAGS})
424-
string(REPLACE ${FILTER_FLAG} "-O1" CMAKE_Fortran_FLAGS_RELEASE ${CMAKE_Fortran_FLAGS_RELEASE})
425-
endforeach ()
422+
if (${CMAKE_Fortran_COMPILER_VERSION} VERSION_LESS_EQUAL 3)
423+
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -fno-unroll-loops")
424+
endif ()
426425
endif ()
427426
endif ()
428427

0 commit comments

Comments
 (0)