From owner-freebsd-standards@freebsd.org Thu Feb 22 14:43:13 2018 Return-Path: Delivered-To: freebsd-standards@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 92CAEF09F7C for ; Thu, 22 Feb 2018 14:43:13 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x235.google.com (mail-it0-x235.google.com [IPv6:2607:f8b0:4001:c0b::235]) (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 22E8686FE7 for ; Thu, 22 Feb 2018 14:43:13 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x235.google.com with SMTP id o9so6482977itc.1 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=Dc1CK36a5nsUbKXOV+M3vXYGQAAkz0sGw1WJwWCywDWCPnSrtiV4PDAOJDhTrCoczh 9V9TIobC2qu27BbOIRGakIOYNmckVNyPSORzxawG5Jx/A47HqjhoyS0nyOtnwGlrQlW0 dsExKFJxdayJt/cd1AooA3jtPIDwSZN5UcbDpuazQTmrIPUq89N9djp4/BgIzWRcAeWg 1EMnUlFf99STjjalLNxPj1YyfES4It/kk9VsgicKnQ6ZOz+ONsZs0nUzNiC2/tq9HPD8 teZ6PY5foiREBBCt4riPQxB2/Ty0nrLzVY4VraLEi6J/iZ9WE52Alv81QVhsYINR6bQx aSKg== X-Gm-Message-State: APf1xPBhFksfr93jjRfPJU0cbwTx+zni8FVjYEuPHUx4OXYQ4ZRcVFat AleFg+FAI+pfVkm0mDCb8p5vx7rhjPRJXwlDrBR3mw== 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-standards@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Standards compliance 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