This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/78420] std::less<T*> is not an total order with optimization enabled


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]