Hello,

On Thu, 18 Apr 2019 14:42:22 +0200 Richard Biener
<richard.guent...@gmail.com> wrote:

> On Thu, Apr 18, 2019 at 2:20 PM Uecker, Martin
> <martin.uec...@med.uni-goettingen.de> wrote:

> > 1.) Compilers do not use conditional equivalences for
> > optimizations of pointers (or only when additional
> > conditions apply which make it safe)
> >
> > 2.) We make pointer comparison between a pointer
> > and a one-after pointer of a different object
> > undefined behaviour.  
> 
> Yes please!

No please don't, not UB.

If any of this, make the result unspecified but not UB, please.

> OTOH GCC transforms
> (uintptr_t)&a != (uintptr_t)(&b+1)
> into &a != &b + 1 (for equality compares) and then
> doesn't follow this C rule anyways.

Actually our proposal we are discussing here goes exactly the other
way around. It basically reduces

  &a != &b + 1

to

  (uintptr_t)&a != (uintptr_t)(&b+1)

with only an exception for null pointers, but which probably don't
matter for a platform where null pointers are just all bits 0.

Jens

-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

Attachment: pgpVQ3zYW3gyA.pgp
Description: Digitale Signatur von OpenPGP

Reply via email to