Re: [PATCH] build: Correctly restore CXXFLAGS/LDFLAGS for zstd test

2026-02-10 Thread Andrew Pinski
On Tue, Feb 10, 2026 at 11:07 AM Andrew Pinski
 wrote:
>
> On Tue, Feb 10, 2026 at 10:52 AM Dimitry Andric  wrote:
> >
> > 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  
> >
> > gcc:
> > PR libfortran/123366
> > * configure.ac: Move restoring of CXXFLAGS/LDFLAGS for zstd test to
> > the correct place.
> > * configure: Regenerate.
>
> Ok.

I missed that you don't have commit access but now pushed as
r16-7441-g1ce1870fbe0b141d38e02b7ac6a41d8d36b73b30.

Thanks,
Andrew

>
> >
> > Signed-off-by: Dimitry Andric 
> > ---
> >  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
> >


Re: [PATCH] build: Correctly restore CXXFLAGS/LDFLAGS for zstd test

2026-02-10 Thread Sam James
Dimitry Andric  writes:

> 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.

LGTM (obvious).

>
> 2026-02-10  Dimitry Andric  
>
>   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 
> ---
>  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


signature.asc
Description: PGP signature


Re: [PATCH] build: Correctly restore CXXFLAGS/LDFLAGS for zstd test

2026-02-10 Thread Andrew Pinski
On Tue, Feb 10, 2026 at 10:52 AM Dimitry Andric  wrote:
>
> 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  
>
> gcc:
> PR libfortran/123366
> * configure.ac: Move restoring of CXXFLAGS/LDFLAGS for zstd test to
> the correct place.
> * configure: Regenerate.

Ok.

>
> Signed-off-by: Dimitry Andric 
> ---
>  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
>