Skip to content

Commit ce34a29

Browse files
committed
1 parent 816a3a0 commit ce34a29

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

fortran/tests/makefiles/Makefile.common

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,15 @@ GFSTD := $(shell [[ $$(($(GFORT) -dumpversion 2>/dev/null || echo 0) | sed 's|\
438438
# allocatable characters. See
439439
# https://fortran-lang.discourse.group/t/warning-str-may-be-used-uninitialized
440440
WE := $(shell if [[ $$(($(GFORT) -dumpversion 2>/dev/null || echo 0) | sed 's|\..*||') -gt 11 || $$(($(GFORT) -dumpversion 2>/dev/null || echo 0) | sed 's|\..*||') -gt 8 && -z '$(FFLAGSG)' ]] ; then echo "-Werror"; else echo ""; fi)
441+
# gfortran 14 has a bug when it is called with `gfortran -Wmaybe-uninitialized -fsanitize=undefined -Ok`,
442+
# where k is 2, 3, 4, or fast. See
443+
# https://fortran-lang.discourse.group/t/gfortran-14-mem-real-kind-4-0-real-kind-4-0-32-0-may-be-used-uninitialized
444+
WU := $(shell if [[ $$(($(GFORT) -dumpversion 2>/dev/null || echo 0) | sed 's|\..*||') -gt 13 && "$(FFLAGS)" != "-g" && "$(FFLAGS)" != "-O" && "$(FFLAGS)" != "-O1" ]] ; then echo "-Wno-uninitialized"; else echo "-Wuninitialized -Wmaybe-uninitialized"; fi)
441445
# gfortran 14+ supports the `-ftrampoline-impl=heap` option, which is needed to avoid the
442446
# warning about executable stacks caused by internal procedures passed as arguments. See
443447
# https://fortran-lang.discourse.group/t/implementation-of-a-parametrized-objective-function-without-using-module-variables-or-internal-subroutines
444-
GTRAMPOLINE := $(shell [[ $$(($(GFORT) -dumpversion 2>/dev/null || echo 0) | sed 's|\..*||') -gt 13 ]] && (echo "-ftrampoline-impl=heap") || echo "")
445-
GFORT := $(GFORT) $(WE) $(GTRAMPOLINE) -pedantic-errors -fmax-errors=1
448+
TRAMPOLINE := $(shell [[ $$(($(GFORT) -dumpversion 2>/dev/null || echo 0) | sed 's|\..*||') -gt 13 ]] && (echo "-ftrampoline-impl=heap") || echo "")
449+
GFORT := $(GFORT) $(WE) $(TRAMPOLINE) -pedantic-errors -fmax-errors=1
446450
# `-fautomatic` (the default) tells `gfortran` to use the stack for local variables smaller than the
447451
# value given by -fmax-stack-var-size. `-fstack-arrays` forces all automatic arrays to be on the stack.
448452
# We enable them for small problems to verify that we will not have stack overflows.
@@ -455,9 +459,10 @@ endif
455459
# -fsanitize=leak,address does not work with gdb.
456460
FSAN := $(shell if [[ $$(($(GFORT) -dumpversion 2>/dev/null || echo 0) | sed 's|\..*||') -gt 9 && $(OSTYPE) != 'MAC' && $(OSTYPE) != 'FREEBSD' ]] ; then echo "-fsanitize=undefined"; else echo ""; fi)
457461
GFORT := $(GFORT) $(GFSTD) -fall-intrinsics -frecursive \
458-
-Wall -Wextra -Wpedantic -pedantic -Wampersand -Wconversion -Wuninitialized -Wmaybe-uninitialized \
462+
-Wall -Wextra -Wpedantic -pedantic -Wampersand -Wconversion \
459463
-Wsurprising -Waliasing -Wimplicit-interface -Wimplicit-procedure -Wintrinsics-std -Wunderflow \
460464
-Wuse-without-only -Wunused-parameter -Wreturn-type \
465+
$(WU) \
461466
$(FSAN) \
462467
-fPIC -fimplicit-none -fbacktrace -fcheck=all \
463468
-ftrapv

0 commit comments

Comments
 (0)