Commit r16-5592-g56889bfec25 added saving and restoring of CXXFLAGS and
LDFLAGS in the gcc configure script, to avoid including the wrong zstd
headers.

However, due to misleading indentation in the configure script, the
restoration of CXXFLAGS and LDFLAGS was put after the if block where the
values were saved. This could cause various interesting effects, among
others segfaults while building gcc in the FreeBSD ports system.

Move the restoration of CXXFLAGS and LDFLAGS to just before the end of
the same if block to fix this.

Thanks to Mark Millard for spotting the actual mistake.

2026-02-10  Dimitry Andric  <[email protected]>

        gcc:
        PR libfortran/123366
        * configure.ac: Move restoring of CXXFLAGS/LDFLAGS for zstd test to
        the correct place.
        * configure: Regenerate.

Signed-off-by: Dimitry Andric <[email protected]>
---
 gcc/configure    | 2 +-
 gcc/configure.ac | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index bad73081a9b..100e6e10012 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -10661,10 +10661,10 @@ $as_echo "#define HAVE_ZSTD_H 1" >>confdefs.h
 elif test "x$with_zstd" != x; then
     as_fn_error $? "Unable to find zstd.h.  See config.log for details." 
"$LINENO" 5
 fi
-fi
 
 CXXFLAGS="$saved_CXXFLAGS"
 LDFLAGS="$saved_LDFLAGS"
+fi
 
 
 
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 7eb86146a10..35af1382cf1 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1565,10 +1565,10 @@ if test $gcc_cv_header_zstd_h = yes; then
 elif test "x$with_zstd" != x; then
     as_fn_error $? "Unable to find zstd.h.  See config.log for details." 
"$LINENO" 5
 fi
-fi
 
 CXXFLAGS="$saved_CXXFLAGS"
 LDFLAGS="$saved_LDFLAGS"
+fi
 
 dnl Disabled until we have a complete test for buggy enum bitfields.
 dnl gcc_AC_C_ENUM_BF_UNSIGNED
-- 
2.53.0

Reply via email to