public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/104858] New: ranges::minmax double dereferences first
@ 2022-03-09 17:01 barry.revzin at gmail dot com
2022-03-10 9:38 ` [Bug libstdc++/104858] " redi at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: barry.revzin at gmail dot com @ 2022-03-09 17:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104858
Bug ID: 104858
Summary: ranges::minmax double dereferences first
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
In
https://github.com/gcc-mirror/gcc/blob/bded0d549fdfdc1328b2c0189dc5f8593b4cbe42/libstdc%2B%2B-v3/include/bits/ranges_algo.h#L3087:
the initial result is constructed as:
minmax_result<range_value_t<_Range>> __result = {*__first, *__first};
If *__first performs actually does work (maybe it's a transformed iterator),
then this is wasteful. But more importantly, if *__first gives you an rvalue
reference, then this moves from that iterator twice.
I think the standard requires ranges::minmax(v | views::as_rvalue) to actually
be valid (assuming an as_rvalue adaptor that ensures that the reference type is
an rvalue).
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/104858] ranges::minmax double dereferences first
2022-03-09 17:01 [Bug libstdc++/104858] New: ranges::minmax double dereferences first barry.revzin at gmail dot com
@ 2022-03-10 9:38 ` redi at gcc dot gnu.org
2022-03-10 15:37 ` ppalka at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-10 9:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104858
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-03-10
Status|UNCONFIRMED |NEW
CC| |ppalka at gcc dot gnu.org
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/104858] ranges::minmax double dereferences first
2022-03-09 17:01 [Bug libstdc++/104858] New: ranges::minmax double dereferences first barry.revzin at gmail dot com
2022-03-10 9:38 ` [Bug libstdc++/104858] " redi at gcc dot gnu.org
@ 2022-03-10 15:37 ` ppalka at gcc dot gnu.org
2022-04-15 18:42 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-03-10 15:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104858
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/104858] ranges::minmax double dereferences first
2022-03-09 17:01 [Bug libstdc++/104858] New: ranges::minmax double dereferences first barry.revzin at gmail dot com
2022-03-10 9:38 ` [Bug libstdc++/104858] " redi at gcc dot gnu.org
2022-03-10 15:37 ` ppalka at gcc dot gnu.org
@ 2022-04-15 18:42 ` cvs-commit at gcc dot gnu.org
2022-04-15 18:44 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-15 18:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104858
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:7e76cef873342a66408c126abceaf7dbddd3f477
commit r12-8178-g7e76cef873342a66408c126abceaf7dbddd3f477
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Apr 15 14:41:14 2022 -0400
libstdc++: Avoid double-deref of __first in ranges::minmax [PR104858]
PR libstdc++/104858
libstdc++-v3/ChangeLog:
* include/bits/ranges_algo.h (__minmax_fn): Avoid dereferencing
__first twice at the start.
* testsuite/25_algorithms/minmax/constrained.cc (test06): New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/104858] ranges::minmax double dereferences first
2022-03-09 17:01 [Bug libstdc++/104858] New: ranges::minmax double dereferences first barry.revzin at gmail dot com
` (2 preceding siblings ...)
2022-04-15 18:42 ` cvs-commit at gcc dot gnu.org
@ 2022-04-15 18:44 ` ppalka at gcc dot gnu.org
2022-06-28 10:48 ` jakub at gcc dot gnu.org
2023-07-07 9:58 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-04-15 18:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104858
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/104858] ranges::minmax double dereferences first
2022-03-09 17:01 [Bug libstdc++/104858] New: ranges::minmax double dereferences first barry.revzin at gmail dot com
` (3 preceding siblings ...)
2022-04-15 18:44 ` ppalka at gcc dot gnu.org
@ 2022-06-28 10:48 ` jakub at gcc dot gnu.org
2023-07-07 9:58 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104858
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |10.5
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/104858] ranges::minmax double dereferences first
2022-03-09 17:01 [Bug libstdc++/104858] New: ranges::minmax double dereferences first barry.revzin at gmail dot com
` (4 preceding siblings ...)
2022-06-28 10:48 ` jakub at gcc dot gnu.org
@ 2023-07-07 9:58 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 9:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104858
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|10.5 |12.0
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-07-07 9:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09 17:01 [Bug libstdc++/104858] New: ranges::minmax double dereferences first barry.revzin at gmail dot com
2022-03-10 9:38 ` [Bug libstdc++/104858] " redi at gcc dot gnu.org
2022-03-10 15:37 ` ppalka at gcc dot gnu.org
2022-04-15 18:42 ` cvs-commit at gcc dot gnu.org
2022-04-15 18:44 ` ppalka at gcc dot gnu.org
2022-06-28 10:48 ` jakub at gcc dot gnu.org
2023-07-07 9:58 ` rguenth 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).