[sr #111401] autoconf 2.73 -std=gnu23 spilling from CC into CC_FOR_BUILD

Khem Raj <[email protected]> Thu, 9 Apr 2026 00:54:44 -0400 (EDT)
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <[email protected]>
--8323329-1714636915-1775710484=:2960846
Content-Type: TEXT/plain; CHARSET=utf-8
Content-Transfer-Encoding: QUOTED-PRINTABLE
Content-Disposition: inline

URL:=0A  <https://savannah.gnu.org/support/?111401>=0A=0A                 S=
ummary: autoconf 2.73 -std=3Dgnu23 spilling from CC into=0ACC_FOR_BUILD=0A =
                  Group: Autoconf=0A               Submitter: khem=0A      =
         Submitted: Thu 09 Apr 2026 04:54:40 AM UTC=0A                Prior=
ity: 5 - Unprioritized=0A                Severity: 3 - Normal=0A           =
       Status: None=0A                 Privacy: Public=0A             Assig=
ned to: None=0A        Originator Email:=0A             Open/Closed: Open=
=0A         Discussion Lock: Unlocked=0A        Operating System: GNU/Linux=
=0A=0A=0A    _______________________________________________________=0A=0AF=
ollow-up Comments:=0A=0A=0A------------------------------------------------=
-------=0ADate: Thu 09 Apr 2026 04:54:40 AM UTC By: Khem Raj <khem>=0AI hav=
e cross-compilation scenario using Openembedded/yocto cross compiling=0Afle=
x.=0A=0ACross-compiler =3D clang-22=0Ahost compiler =3D gcc-13=0A=0Aflex is=
 autoreconfigured, it builds stage1flex tool, stage1flex is built=0Aduring =
the first/native stage of a flex therefore it uses host compiler but=0Amain=
 flex is then cross-compiled using cross compiler.=0A=0ANewly generated con=
figure tries to see if CC has C23 turned on by default and=0Arightly finds =
that clang does not ( it defaults to gnu17 ) therefore adds=0A-std=3Dgnu23 =
to CC, so far so good. It then uses the detected cached value when=0Apoking=
 CC_FOR_BUILD, in here it thinks, oh I have already performed this check=0A=
so bails out and unconditionally appends -std=3Dgnu23 to CC_FOR_BUILD, howe=
ver=0ACC_FOR_BUILD here is GCC-13 and it does not have gnu23 as dialect sel=
ection=0Ausing -std=3D and the build fails=0A=0A| gcc: error: unrecognized =
command-line option =E2=80=98-std=3Dgnu23=E2=80=99; did you mean=0A=E2=80=
=98-std=3Dgnu2x=E2=80=99?=0A| gcc: error: unrecognized command-line option =
=E2=80=98-std=3Dgnu23=E2=80=99; did you mean=0A=E2=80=98-std=3Dgnu2x=E2=80=
=99?=0A| gcc: error: unrecognized command-line option =E2=80=98-std=3Dgnu23=
=E2=80=99; did you mean=0A=E2=80=98-std=3Dgnu2x=E2=80=99?=0A=0AI tried to f=
ix it, but the patch did not work. My workaround currently is to=0Apass ac_=
cv_prog_cc_stdc=3Dno to configure invocation but thats a hack IMO. I=0Athin=
k lib/autoconf/c.m4 should consider this case where CC and CC_FOR_BUILD=0Ac=
an be different compilers. This issue can also happen with a version of gcc=
=0Ae.g. gcc-14 as cross-compiler and gcc-13 or older as native host compile=
r.=0A=0A=0A=0A=0A=0A=0A=0A=0A    __________________________________________=
_____________=0A=0AReply to this item at:=0A=0A  <https://savannah.gnu.org/=
support/?111401>=0A=0A_______________________________________________=0AMes=
sage sent via Savannah=0Ahttps://savannah.gnu.org/=0A
--8323329-1714636915-1775710484=:2960846
Content-Type: APPLICATION/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCadcxFAAKCRCqLAuaBUf3
TkL8AQCJ/VzHKp3DXYDOR6CkMxr//jc7r8UGtINsiHIrkfJMZwEAgANIt6+PUPKl
KwGs+rsdQLYlv3qC1eyAreQqGlEShwk=
=qClK
-----END PGP SIGNATURE-----

--8323329-1714636915-1775710484=:2960846--