From 174d4edab2d30ea6d0365e942d2e678193e8641b Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Thu, 16 Mar 2023 15:29:52 +0100
Subject: [PATCH] Philippe 16/03/2023: GCC: workaround bug 109157 with
 -fbounds-check

---
 src/Rules.LXgfortran.mk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/Rules.LXgfortran.mk b/src/Rules.LXgfortran.mk
index e9cbd402e..c7b137361 100644
--- a/src/Rules.LXgfortran.mk
+++ b/src/Rules.LXgfortran.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -50,6 +50,9 @@ OPT       = $(OPT_BASE) $(OPT_PERF0) $(OPT_CHECK)
 OPT0      = $(OPT_BASE) $(OPT_PERF0) $(OPT_CHECK)
 OPT_NOCB  = $(OPT_BASE) $(OPT_PERF0)
 CFLAGS    += -g -O0
+#-fbounds-check is bugged for GCC 11 and 12 (up to at least 12.2) in some special cases (GCC bug 109157)
+OBJS_NOBOUNDSCHECK = spll_mode_write_diachro.o
+$(OBJS_NOBOUNDSCHECK) : OPT = $(OPT_BASE) $(OPT_PERF0) -finit-real=nan
 endif
 #
 #  
-- 
GitLab