* [Bug libstdc++/80331] unused const std::string not optimized away
[not found] <bug-80331-4@http.gcc.gnu.org/bugzilla/>
@ 2022-01-07 2:03 ` pinskia at gcc dot gnu.org
2022-01-07 2:21 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07 2:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80331
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-01-07
Resolution|DUPLICATE |---
Status|RESOLVED |NEW
Ever confirmed|0 |1
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reopening as it is not a dup of that one (though I think there is another bug
about this one).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/80331] unused const std::string not optimized away
[not found] <bug-80331-4@http.gcc.gnu.org/bugzilla/>
2022-01-07 2:03 ` [Bug libstdc++/80331] unused const std::string not optimized away pinskia at gcc dot gnu.org
@ 2022-01-07 2:21 ` pinskia at gcc dot gnu.org
2022-01-07 10:54 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07 2:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80331
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
With -std=c++20 -O2 I get better code than just -std=c++17 -O2:
_34 = operator new (24);
__builtin_memcpy (_34, "a ", 23);
MEM[(char_type &)_34 + 23] = 0;
operator delete (_34, 24);
That is all I think due to what is referenced in PR 86590.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/80331] unused const std::string not optimized away
[not found] <bug-80331-4@http.gcc.gnu.org/bugzilla/>
2022-01-07 2:03 ` [Bug libstdc++/80331] unused const std::string not optimized away pinskia at gcc dot gnu.org
2022-01-07 2:21 ` pinskia at gcc dot gnu.org
@ 2022-01-07 10:54 ` redi at gcc dot gnu.org
2022-06-04 22:55 ` hiraditya at msn dot com
2022-06-05 7:54 ` glisse at gcc dot gnu.org
4 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-01-07 10:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80331
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #7)
> With -std=c++20 -O2 I get better code than just -std=c++17 -O2:
> _34 = operator new (24);
> __builtin_memcpy (_34, "a ", 23);
> MEM[(char_type &)_34 + 23] = 0;
> operator delete (_34, 24);
>
> That is all I think due to what is referenced in PR 86590.
Yes, it's because the explicit instantiations are disabled for C++20:
# if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0
extern template class basic_string<char>;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/80331] unused const std::string not optimized away
[not found] <bug-80331-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2022-01-07 10:54 ` redi at gcc dot gnu.org
@ 2022-06-04 22:55 ` hiraditya at msn dot com
2022-06-05 7:54 ` glisse at gcc dot gnu.org
4 siblings, 0 replies; 5+ messages in thread
From: hiraditya at msn dot com @ 2022-06-04 22:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80331
--- Comment #9 from AK <hiraditya at msn dot com> ---
can't repro this with gcc 12.1 Seems like this is fixed?
https://godbolt.org/z/e6n94zK4E
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/80331] unused const std::string not optimized away
[not found] <bug-80331-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2022-06-04 22:55 ` hiraditya at msn dot com
@ 2022-06-05 7:54 ` glisse at gcc dot gnu.org
4 siblings, 0 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2022-06-05 7:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80331
--- Comment #10 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to AK from comment #9)
> can't repro this with gcc 12.1 Seems like this is fixed?
No. As stated in other comments, it still reproduces with a longer string (or
with -D_GLIBCXX_USE_CXX11_ABI=0).
^ permalink raw reply [flat|nested] 5+ messages in thread