https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107790
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-11-21
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
Something like:
diff --git a/gcc/cp/g++spec.cc b/gcc/cp/g++spec.cc
index 257e49b7f3f..d4494bf266f 100644
--- a/gcc/cp/g++spec.cc
+++ b/gcc/cp/g++spec.cc
@@ -307,6 +307,7 @@ lang_specific_driver (struct cl_decoded_option
**in_decoded_options,
/* Copy the 0th argument, i.e., the name of the program itself. */
new_decoded_options[j++] = decoded_options[i++];
+ bool needscxxexpadded = false;
/* NOTE: We start at 1 now, not 0. */
while (i < argc)
@@ -357,8 +358,7 @@ lang_specific_driver (struct cl_decoded_option
**in_decoded_options,
if ((args[i] & EXPERIMENTAL)
&& which_library == USE_LIBSTDCXX)
- generate_option (OPT_l, "stdc++exp", 1, CL_DRIVER,
- &new_decoded_options[++j]);
+ needscxxexpadded = true;
if ((args[i] & SKIPOPT) != 0)
--j;
@@ -367,6 +367,10 @@ lang_specific_driver (struct cl_decoded_option
**in_decoded_options,
j++;
}
+ if (needscxxexpadded)
+ generate_option (OPT_l, "stdc++exp", 1, CL_DRIVER,
+ &new_decoded_options[++j]);
+
/* Add `-lstdc++' if we haven't already done so. */
if (library > 0)
{