From owner-freebsd-hackers@freebsd.org Thu Feb 22 19:42:41 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 EE025F25091 for ; Thu, 22 Feb 2018 19:42:40 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-qt0-x22c.google.com (mail-qt0-x22c.google.com [IPv6:2607:f8b0:400d:c0d::22c]) (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 7D33674E2B for ; Thu, 22 Feb 2018 19:42:40 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: by mail-qt0-x22c.google.com with SMTP id m13so3056441qtg.13 for ; Thu, 22 Feb 2018 11:42:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Az/Y2jgP1/LWb2ojSWHIvH6X9NYXxZaprxLuWwWLc3M=; b=ttm2Dsq5lacKRgNFstSklTiH1ReurUahNm0XU7b/7uiVbdPzO1ZvaI0ArGyYlOrfYb dGkHFree+eiuBwJH+J25jSmiwuuHhycsVgBMXcI7v+Im/WF6auv6tEJBVtD1f/nuNPo2 1gNLcybYpovRPdnqOncoBvj5emNoDLBwM+iyo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Az/Y2jgP1/LWb2ojSWHIvH6X9NYXxZaprxLuWwWLc3M=; b=sIThYDpvwkyKwAE9UPt2RXnGX8K40wNkqZ+lBZ13Ja77Pen2aafsByrbHwTbeA4JFS qjcR6FIRHeO8+BQX3FEQz1KBkIsIfuaV08zP77nNUwJx8GsSuZ6L1QcNDG8aaqKz1WrK ltCsVd4Zvsvi23pnTEHJxb0xq7arQlq+WAOVuD1MF92fS0QwgExd9FUirm2lFSXisI6F NOEVTyaKzvvXdOdJVs9bXOy4NXeFPWf6YYib+t8GQEJ3qyEZ8by3vt14kP7HkzT0AZCI GEzMT2yf3D9RkmfSctj80yAlrBiWco7+BDka6YxZ6U9/EvJi+qg2++3ov9K/pP+oelXF hgWA== X-Gm-Message-State: APf1xPBligmrOg4wz7BCCv+stBZfSQEGoHxlA5bI3KwnbcmIk/d/rcma i9TyC+nXogEGAxBWgkrLista1YMyIOoBdcXW7pnMsg== X-Google-Smtp-Source: AH8x224/5zKCCC9mN3j1sS3nbvIukj61GaIiKTYwJ9Gz2CGcocIIoJRGg3JJi2ijbRBDl9a34gJd2HC0z4HEbKwM50c= X-Received: by 10.237.55.33 with SMTP id i30mr13019262qtb.202.1519328559888; Thu, 22 Feb 2018 11:42:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.25.173 with HTTP; Thu, 22 Feb 2018 11:42:09 -0800 (PST) In-Reply-To: References: <20180221032247.GA81670@ns.kevlo.org> <20180221104400.GU94212@kib.kiev.ua> <20180222112752.10da7e51@kalimero.tijl.coosemans.org> <20180222105608.GE94212@kib.kiev.ua> From: Eitan Adler Date: Thu, 22 Feb 2018 11:42:09 -0800 Message-ID: Subject: Re: Marking select(2) as restrict To: Warner Losh Cc: Konstantin Belousov , FreeBSD Hackers , Tijl Coosemans , FreeBSD Standards , Kevin Lo Content-Type: text/plain; charset="UTF-8" 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 19:42:41 -0000 On 22 February 2018 at 06:43, Warner Losh wrote: > 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 Compilers cannot fail since errors are only detectable at runtime. The value of the exp-run is (a) ensuring that we don't break prototypes of some applications (b) exercising the applications as much as we can -- Eitan Adler