This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/78420] std::less<T*> is not an total order with optimization enabled
- From: "tomaszkam at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 18 Nov 2016 13:12:13 +0000
- Subject: [Bug c++/78420] std::less<T*> is not an total order with optimization enabled
- Auto-submitted: auto-generated
- References: <bug-78420-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78420
--- Comment #1 from Tomasz Kamiński <tomaszkam at gmail dot com> ---
This is probably effect on changing !lt(a,b) && !lt(b, a) into !(a<b) && !(b<a)
and then a == b. Then following comparision is unspecified according to 5.10
[expr.eq] p2.1:
If at least one of the operands is a pointer, pointer conversions (4.11),
function pointer conversions (4.13), and qualification conversions (4.5) are
performed on both operands to bring them to their composite pointer
type (Clause 5). Comparing pointers is defined as follows:
— (2.1) If one pointer represents the address of a complete object, and another
pointer represents the address one past the last element of a different
complete object, the result of the comparison is unspecified.
However I believe that in light of 20.14.6 [comparisons] p14, above
transformation is not allowed.