From owner-freebsd-hackers@freebsd.org Thu Feb 22 10:56:21 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 E11C1F217A9; Thu, 22 Feb 2018 10:56:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 596C27AFC4; Thu, 22 Feb 2018 10:56:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w1MAu905013493 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 Feb 2018 12:56:12 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w1MAu905013493 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w1MAu8Bw013492; Thu, 22 Feb 2018 12:56:08 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 22 Feb 2018 12:56:08 +0200 From: Konstantin Belousov To: Tijl Coosemans Cc: Eitan Adler , Kevin Lo , FreeBSD Standards , FreeBSD Hackers Subject: Re: Marking select(2) as restrict Message-ID: <20180222105608.GE94212@kib.kiev.ua> References: <20180221032247.GA81670@ns.kevlo.org> <20180221104400.GU94212@kib.kiev.ua> <20180222112752.10da7e51@kalimero.tijl.coosemans.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180222112752.10da7e51@kalimero.tijl.coosemans.org> User-Agent: Mutt/1.9.3 (2018-01-21) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home 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 10:56:22 -0000 On Thu, Feb 22, 2018 at 11:27:52AM +0100, Tijl Coosemans wrote: > On Wed, 21 Feb 2018 12:44:00 +0200 Konstantin Belousov 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.