Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Feb 2018 07:43:11 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Tijl Coosemans <tijl@freebsd.org>, FreeBSD Standards <freebsd-standards@freebsd.org>,  FreeBSD Hackers <freebsd-hackers@freebsd.org>, Kevin Lo <kevlo@freebsd.org>
Subject:   Re: Marking select(2) as restrict
Message-ID:  <CANCZdfrDCt6JCWcZDk8c3AdqX%2B1MwbUH2cNr=NqqyP7gWmUByg@mail.gmail.com>
In-Reply-To: <20180222105608.GE94212@kib.kiev.ua>
References:  <CAF6rxg=h_oMiUu7P=GAOQf_OySQM2w31hg6Kas%2B3jeEM3qq_Cg@mail.gmail.com> <CAF6rxgnt9c0n8i-nHQwoKGbZKF2hM5AZqEJnz0CLo26XOO4_sg@mail.gmail.com> <20180221032247.GA81670@ns.kevlo.org> <CAF6rxg=WwqeBnmJzfOZgtwrYesXPfvJFeaVmQwtTa_89_sxaJg@mail.gmail.com> <CANCZdfo46bhfaRpbqOmJjk4%2B=1R2c5kvmrJPENaxNgK==5M4kg@mail.gmail.com> <CAF6rxg=wNVgDUF9o744ngmzPNeHB3hqdrLufy=yS3D4osczxFQ@mail.gmail.com> <20180221104400.GU94212@kib.kiev.ua> <20180222112752.10da7e51@kalimero.tijl.coosemans.org> <20180222105608.GE94212@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 22, 2018 at 3:56 AM, Konstantin Belousov <kostikbel@gmail.com>
wrote:

> On Thu, Feb 22, 2018 at 11:27:52AM +0100, Tijl Coosemans wrote:
> > On Wed, 21 Feb 2018 12:44:00 +0200 Konstantin Belousov <
> kostikbel@gmail.com> wrote:
> > > On Tue, Feb 20, 2018 at 10:14:05PM -0800, Eitan Adler wrote:
> > >> On 20 February 2018 at 21:19, Warner Losh <imp@bsdimp.com> wrote:
> > >>> Once upon a time, this would break a lot of code. Perhaps times have
> > >>> changed.
> > >>
> > >> I've seen very little code that this would break though some of it
> > >> certainly exists.
> > > You certainly seen very little code, but the question was about the
> > > existed code.
> >
> > FWIW, it seems that glibc uses restrict since 2000 so there's unlikely to
> > be much fallout:
> > https://sourceware.org/git/?p=glibc.git;a=blob;f=misc/sys/select.h
> > https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=
> 98cbe360d947b59e7a5eda068581f4cfeb4b99b3
>
> Clearly, nobody knowns.  At least, glibc is used with gcc compilation, not
> with clang.
>
> Consider the recently changed devd code:
>         select(n + 1, &fd, &fd, &fd);
> There, compiler can see that restrict is applied to arguments which are
> given same values.  Since this leads to the self-contradicting statement
>         fd != fd
> which cannot be true, compliler in its optimizing wisdom can assume that
> the code is never executing and remove it.  I do not know whether clang
> actually makes such transformation, but it does not sound unfeasible
> looking at its other advances.
>

If the compilers affirmatively fails when this happens, then the exp run
will catch this stuff. If it doesn't, or just gives a warning, it likely
will not.
Absent that, nobody can say with certainty this change won't break
anything.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfrDCt6JCWcZDk8c3AdqX%2B1MwbUH2cNr=NqqyP7gWmUByg>