https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91227

--- Comment #8 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to rguent...@suse.de from comment #5)
> Does "unspecified" allow p > q != !(p <= q)?  I think so (it's not
> implementation defined).

The exact C++ words that apply here are:

(4.3)  Otherwise [if two unequal pointers don't point into the same object],
neither pointer is required to compare greater than the other.

(it's not explicitly unspecified, but it sounds at least as loose).  So the
answer is yes.

I agree with producing a sensible result for QoI (especially if there's no
warning).  A result that's consistent between [in]equality and relational
expressions would qualify.

I also agree that diagnosing all these unspecified (or undefined in C) cases
would be helpful as they (at least in the straightforward instances) are most
likely coding mistakes.  I might look into it, though my first concern is about
the instances that result from some earlier transformations and where warnings
will be seen as false positives.

Reply via email to