From owner-freebsd-hackers@freebsd.org Thu Feb 22 14:43:13 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95231F09F7D for ; Thu, 22 Feb 2018 14:43:13 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22e.google.com (mail-it0-x22e.google.com [IPv6:2607:f8b0:4001:c0b::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 238B686FE8 for ; Thu, 22 Feb 2018 14:43:13 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22e.google.com with SMTP id p204so6480496itc.4 for ; Thu, 22 Feb 2018 06:43:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=EM2KxAZL0XlKpUghAGAK4YI/6AP1FycMznJ54Q1qHyw=; b=W6+hiLqGilN/tl3OZ39a7jYcLDp1bc+racuYui2dIe19Ps+09R0Rk8/CdAbuLiqzWZ YSqcAgEgsrbt39ZhX2Y7G/8LrdooJamp9/1Fi52y2emqLTugVZnhzLqmXqyLsly2TOrw QFbvY/V5GWxpetV4krypRC4zi5YoXM6B6F6yqLb2+t1zKChS9cpn/Cq1czMUn3w7RNAt CMTaV1DOtQzEGDsX4m5ut/EigUds7wGviPm3MB2fKOh/gIxc7XiOMvdaZ1rm6mLmaBt4 +isK1MIYJVVeewlqOUrLUrGc7WRgPVKhKXWWTL1GbZjfV4Yk3ZxqH+hBFyHp9OYJo2fv VZGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=EM2KxAZL0XlKpUghAGAK4YI/6AP1FycMznJ54Q1qHyw=; b=W92qsAkjsQqyjg0GpWQ/MxYH/crBRtMYhk1xrR1KsqKwZCgwAnumv0EQOPuaGioIC8 7A50pbRm6U2chHBXhXhA06tv0P88Snu9gwmA3f0a8vnBEuWsV8/UwbZt1vuvmD+CuNug PiIBvxfga7xSn4YImuEgcNfBibEj1R43MTos4GfdLwMCDbAV5wIVu/N8KqUdlBrTDmA+ xbcEVVzIob4sSipJrcunEDLhYh7j4o+tPrt74GpBM6HadDaKpUFvHkVJcb51XI2zKHdR pBHuKZ3SEWeePDeDgQB2OjgS+SN/36vgUu6WHB+bdBeQPv2WKyahxlAgob3qK49WvsAe xktg== X-Gm-Message-State: APf1xPANbnjtS7kZCVfttpEIX8IfW8vPXP52W9yrtmiZD2FeEgR06BsX 1m1G/lZCke2CFY8/fCDaP1Bv7IN70U2lrnRcUR24+g== X-Google-Smtp-Source: AH8x225fxLzIL+FiRRoRNva9EsVMydE2iVl/B3mbsn/qp0AImMFXNnP/Nsz0ehtl7jb2NhviGGqGFiFnVBIGOG+rQvA= X-Received: by 10.36.6.70 with SMTP id 67mr1664189itv.57.1519310592351; Thu, 22 Feb 2018 06:43:12 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Thu, 22 Feb 2018 06:43:11 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:18a2:a4f7:170:8dd9] In-Reply-To: <20180222105608.GE94212@kib.kiev.ua> References: <20180221032247.GA81670@ns.kevlo.org> <20180221104400.GU94212@kib.kiev.ua> <20180222112752.10da7e51@kalimero.tijl.coosemans.org> <20180222105608.GE94212@kib.kiev.ua> From: Warner Losh Date: Thu, 22 Feb 2018 07:43:11 -0700 X-Google-Sender-Auth: iQ1hcDK5R_Eedt1-bvTRbCjG1nA Message-ID: Subject: Re: Marking select(2) as restrict To: Konstantin Belousov Cc: Tijl Coosemans , FreeBSD Standards , FreeBSD Hackers , Kevin Lo Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 14:43:13 -0000 On Thu, Feb 22, 2018 at 3:56 AM, Konstantin Belousov 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 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