https://gcc.gnu.org/g:1ce1870fbe0b141d38e02b7ac6a41d8d36b73b30

commit r16-7441-g1ce1870fbe0b141d38e02b7ac6a41d8d36b73b30
Author: Dimitry Andric <[email protected]>
Date:   Tue Feb 10 19:51:58 2026 +0100

    build: Correctly restore CXXFLAGS/LDFLAGS for zstd test
    
    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]>

Diff:
---
 gcc/configure    | 2 +-
 gcc/configure.ac | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index bad73081a9b8..100e6e100120 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 7eb86146a104..35af1382cf1a 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

Reply via email to