Use only -O1 with AMD AOCC version of flang
to prevent miscompilation of LAPACK codes and tests on Ryzen
@@ -783,6 +783,7 @@ endif
ifeq ($(F_COMPILER), FLANG)
CCOMMON_OPT += -DF_INTERFACE_FLANG
+FCOMMON_OPT += -frecursive
ifdef BINARY64
ifdef INTERFACE64
ifneq ($(INTERFACE64), 0)
@@ -796,6 +797,11 @@ endif
ifeq ($(USE_OPENMP), 1)
FCOMMON_OPT += -fopenmp
endif
+ifeq ($(OSNAME), Linux)
+ifeq ($(ARCH), x86_64)
+FLANG_VENDOR := $(shell expr `$(FC) --version|cut -f 1 -d "."|head -1`)
+endif
+endif
endif
ifeq ($(F_COMPILER), G77)
@@ -1270,8 +1276,11 @@ endif
override CFLAGS += $(COMMON_OPT) $(CCOMMON_OPT) -I$(TOPDIR)
override PFLAGS += $(COMMON_OPT) $(CCOMMON_OPT) -I$(TOPDIR) -DPROFILE $(COMMON_PROF)
-
+ifeq ($(FLANG_VENDOR),AOCC)
+override FFLAGS += $(filter-out -O2 -O3,$(COMMON_OPT)) -O1 $(FCOMMON_OPT)
+else
override FFLAGS += $(COMMON_OPT) $(FCOMMON_OPT)
+endif
override FPFLAGS += $(FCOMMON_OPT) $(COMMON_PROF)
#MAKEOVERRIDES =
