https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123366
--- Comment #35 from Mark Millard <markmigm at gmail dot com> ---
(In reply to Dimitry Andric from comment #12)
> Bisecting seems to point at commit
> r16-5592-g56889bfec25e467deedb2750bdae7ec456a8f92c ("build: Save/restore
> CXXFLAGS for zstd tests") by Rainer Orth.
>
> I don't completely understand the mechanism though, so I hope somebody else
> has a good insight. :)
The insight is that the code structure has part of the
code out of place. It has:
if . . .
. . .
saved_CXXFLAGS="$CXXFLAGS"
saved_LDFLAGS="$LDFLAGS"
. . .
fi
CXXFLAGS="$saved_CXXFLAGS"
LDFLAGS="$saved_LDFLAGS"
It should be:
if . . .
. . .
saved_CXXFLAGS="$CXXFLAGS"
saved_LDFLAGS="$LDFLAGS"
. . .
CXXFLAGS="$saved_CXXFLAGS"
LDFLAGS="$saved_LDFLAGS"
fi
(There are nested if's involved that make it hard to track
by reading as the text is organized.)