From 87d66ec33baaa9f5f2001f6dacdfe55928627317 Mon Sep 17 00:00:00 2001 From: Soren Rasmussen Date: Tue, 28 Nov 2023 12:18:11 -0700 Subject: [PATCH] The Cray v15.0.1 compiler is make optimizations of the derived type logical members that leads to incorrect values when ICAR is setting logical values after reading from namelists. Turning optimization off for the options_obs.F90 will fix this issue. --- src/makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/makefile b/src/makefile index 1ecc0d08..da55d4b8 100644 --- a/src/makefile +++ b/src/makefile @@ -328,6 +328,14 @@ ASSERT=-DUSE_ASSERTIONS=$(USE_ASSERTIONS) LFLAGS=$(LINK) $(PROF) $(CAF_FLAG) $(CAF_LINK) $(LIBNETCDF) $(LIBFFT) FFLAGS=$(COMP) $(PROF) $(CAF_FLAG) $(PREPROC) -DVERSION=\"$(GIT_VERSION)\" $(INCNETCDF) $(INCFFT) $(MODOUTPUT) $(ASSERT) +# this line is to handle the fact the Cray compiler does optimizations that +# make setting logical values in derived types unrealiable in options_obs.F90 +ifeq ($(COMPILER), cray) + OPTIONS_FLAGS=${FFLAGS} -O0 +else + OPTIONS_FLAGS=${FFLAGS} +endif + $(info $$NODENAME = ${NODENAME}) $(info $$FC = ${F90}) $(info $$FFTW_PATH = ${FFTW_PATH}) @@ -592,6 +600,9 @@ caf_threads_test: $(BUILD)test_caf_threads.o # Generic compilation rules ################################################################### +$(BUILD)options_obj.o: $(OBJECTS)options_obj.f90 + ${F90} ${OPTIONS_FLAGS} $< -o $@ + $(BUILD)%.o: $(UTIL)%.f90 ${F90} ${FFLAGS} $< -o $@