Date: Thu, 22 Feb 2018 12:04:45 -0800 From: Conrad Meyer <cem@freebsd.org> To: Eitan Adler <lists@eitanadler.com> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org>, FreeBSD Standards <freebsd-standards@freebsd.org> Subject: Re: Marking select(2) as restrict Message-ID: <CAG6CVpXfcNfQmJkertq%2BpMg3DtmsJjYC4TsX%2Bjd-7PgMF%2B6cKg@mail.gmail.com> In-Reply-To: <CAF6rxgn=-J5uAAG86zgV-vFiPpzgoFre-nBZ94EPPKz9eCX8Jg@mail.gmail.com> 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> <CANCZdfrDCt6JCWcZDk8c3AdqX%2B1MwbUH2cNr=NqqyP7gWmUByg@mail.gmail.com> <CAF6rxgn=-J5uAAG86zgV-vFiPpzgoFre-nBZ94EPPKz9eCX8Jg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 22, 2018 at 11:42 AM, Eitan Adler <lists@eitanadler.com> wrote: > On 22 February 2018 at 06:43, Warner Losh <imp@bsdimp.com> wrote: >> If the compilers affirmatively fails when this happens > > Compilers cannot fail since errors are only detectable at runtime. This is simply not true. *Some* instances of this error could only be detected at run time, but compilers can and do perform some kinds of static analysis for warning/error purposes and for optimization. In the extremely common case where fdsets are local or global variables, the compiler could easily detect when the same pointer is passed multiple times. If we're unlucky, it produces no warning and "optimizes" the undefined behavior into something awful. In my local testing, neither Clang nor GCC6 produces any error or warning for this, which is disappointing.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpXfcNfQmJkertq%2BpMg3DtmsJjYC4TsX%2Bjd-7PgMF%2B6cKg>