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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #3)
> Other options perhaps could be - (__x._M_node ? 1 : 0)

That produces worse code (with a jump) at -O1

> or - 1 + !__x._M_node

Isn't that undefined for (x - y - 1 + !x) if x and y are both null?
We get (T*)0 - 1 + 1 which overflows twice.

> or - !!__x._M_node

I think that's what I'll go with, thanks.

Reply via email to