This is the mail archive of the gcc@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]

Re: C provenance semantics proposal


Am Freitag, den 19.04.2019, 10:19 +0200 schrieb Jens Gustedt:
> Hello,
> 
> On Thu, 18 Apr 2019 14:42:22 +0200 Richard Biener
> <richard.guenther@gmail.com> wrote:
> 
> > On Thu, Apr 18, 2019 at 2:20 PM Uecker, Martin
> > <Martin.Uecker@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.

Making it unspecified would not help with
conditional equivalences. The problem here
is that compilers would like to assume (and
sometimes incorrectly already do so) that in the
following conditional comparison one
may substitute 'a' for 'b':

if (a == b) {

	*b = 1;
}

This is guaranteed to work only if comparison
implies identical semantics but this isn't
the case for pointers with provenance.

Best,
Martin

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