public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107790] New: -fcontracts needs to add -lstdc++exp at the end of the collect2 options
@ 2022-11-21 11:35 redi at gcc dot gnu.org
2022-11-21 16:32 ` [Bug c++/107790] " pinskia at gcc dot gnu.org
2022-11-22 4:47 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-21 11:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107790
Bug ID: 107790
Summary: -fcontracts needs to add -lstdc++exp at the end of the
collect2 options
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: link-failure
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
This links OK:
g++20 fail.cc -fcontracts
But this doesn't:
fail.cc: In function 'int f(int, int)':
fail.cc:1:45: warning: unused parameter '__r' [-Wunused-parameter]
1 | int f(int x) [[pre: x > 0]] [[post r: r > 0]]
| ^
The problem is that static libs need to be listed after the .o file.
Test case:
int f(int x) [[pre: x > 0]] [[post r: r > 0]]
{
return -5;
}
int main()
{
f(42);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/107790] -fcontracts needs to add -lstdc++exp at the end of the collect2 options
2022-11-21 11:35 [Bug c++/107790] New: -fcontracts needs to add -lstdc++exp at the end of the collect2 options redi at gcc dot gnu.org
@ 2022-11-21 16:32 ` pinskia at gcc dot gnu.org
2022-11-22 4:47 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-21 16:32 UTC (permalink / raw)
To: gcc-bugs
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)
{
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/107790] -fcontracts needs to add -lstdc++exp at the end of the collect2 options
2022-11-21 11:35 [Bug c++/107790] New: -fcontracts needs to add -lstdc++exp at the end of the collect2 options redi at gcc dot gnu.org
2022-11-21 16:32 ` [Bug c++/107790] " pinskia at gcc dot gnu.org
@ 2022-11-22 4:47 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-22 4:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107790
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Target Milestone|--- |13.0
Resolution|--- |FIXED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed by r13-4223-gb20a3854c9f29 .
https://gcc.gnu.org/pipermail/gcc-cvs/2022-November/374653.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-22 4:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21 11:35 [Bug c++/107790] New: -fcontracts needs to add -lstdc++exp at the end of the collect2 options redi at gcc dot gnu.org
2022-11-21 16:32 ` [Bug c++/107790] " pinskia at gcc dot gnu.org
2022-11-22 4:47 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).