From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4BD0C433EF for ; Thu, 18 Nov 2021 23:45:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A352461AA5 for ; Thu, 18 Nov 2021 23:45:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233102AbhKRXsr (ORCPT ); Thu, 18 Nov 2021 18:48:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:32906 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbhKRXsr (ORCPT ); Thu, 18 Nov 2021 18:48:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637279146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YRMwL37sSn+dllXVC3jRMvcenv4v5h1Vmq8DncNyKb8=; b=NUfB+iQCoNqF8v/GS0KiOnRTf1a1nbemCIdGeyn/v7TB2UZ9uua1FDZrD9uK/HC47NYCqu yRCujk/mtvQGXwXM0Zbsa7UjPsfjZr/8N+XrmEZPDVqHSorK4blambaUsa3pf0DpCqSruM Z+/6sTw9QWUDiS6mdxHzMVb0aS6QhIs= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-20-Zkt3DBlbOFiu53y7RdWtUA-1; Thu, 18 Nov 2021 18:45:44 -0500 X-MC-Unique: Zkt3DBlbOFiu53y7RdWtUA-1 Received: by mail-qv1-f71.google.com with SMTP id fw10-20020a056214238a00b003c05d328ad2so7357754qvb.2 for ; Thu, 18 Nov 2021 15:45:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=YRMwL37sSn+dllXVC3jRMvcenv4v5h1Vmq8DncNyKb8=; b=crWrzEMLoSjfrnFwKA+T79h1rNY10EGq3K92W9dSo0ZBYrsjRbz4Vex+ra1dANYFCx fLv/nGfPLhfjrt/rluLsz9jDWRVCBbo3z+Nltet4X0bq2ggBoJQKmoI0w2txInBAenYA Yo6X5D6PcpHVTfa6+qZsZxc1tJPiqPuFAQBv/pJwXZCB7g5REbPczXudm0vgDYQFTRAq 190vS4Dn/SNhZorEmuig9CL8UbDthI4Q69mBFxvibd25gi6sg+CQwr/0PmJZjCL6Yijx Hzkbi//dawuJrjQmXWpgZFkl4IB+5tb9cTyriL28YHxzLimHu8rmHs0a+yIf57Q2IVV/ 9IYg== X-Gm-Message-State: AOAM533XC/05k3c0vIdZfKLYevwyVIESyijHx84zvQAGWNR8DS922Sag ZmxZ7d4XpwxM8uUbAC/x4bX88c7jTgluzZih4xBqL3lCgNEN+970GBfabMA6zU219wGNgaVcoGs yyvmmVLxKQu2yhoZOwIdoPU3D4fvSpA== X-Received: by 2002:a37:6152:: with SMTP id v79mr24704195qkb.188.1637279144070; Thu, 18 Nov 2021 15:45:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVA8mLtafMytw4TRjx4MXZEMwIfqkd7wPK1zpUsV57upg9KVpYVf5efReSxIYzWrQbKhnf6A== X-Received: by 2002:a37:6152:: with SMTP id v79mr24704174qkb.188.1637279143884; Thu, 18 Nov 2021 15:45:43 -0800 (PST) Received: from t14s.localdomain (c-73-69-212-193.hsd1.ma.comcast.net. [73.69.212.193]) by smtp.gmail.com with ESMTPSA id y18sm720972qtx.19.2021.11.18.15.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 15:45:43 -0800 (PST) Message-ID: <31ddd9b4d47f0e105635849a079b1de659854a23.camel@redhat.com> Subject: Re: [PATCH 2/6] Add returns_zero_on_success/failure attributes From: David Malcolm To: Segher Boessenkool , Joseph Myers Cc: Prathamesh Kulkarni , gcc-patches@gcc.gnu.org, linux-toolchains@vger.kernel.org Date: Thu, 18 Nov 2021 18:45:42 -0500 In-Reply-To: <20211118200843.GY614@gate.crashing.org> References: <20211113203732.2098220-1-dmalcolm@redhat.com> <20211113203732.2098220-4-dmalcolm@redhat.com> <15adb3a2a70b0d2973c30dd6d7da383ad62f413a.camel@redhat.com> <20211118200843.GY614@gate.crashing.org> User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmalcolm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org On Thu, 2021-11-18 at 14:08 -0600, Segher Boessenkool wrote: > On Wed, Nov 17, 2021 at 10:43:58PM +0000, Joseph Myers wrote: > > On Wed, 17 Nov 2021, Prathamesh Kulkarni via Gcc-patches wrote: > > > More generally, would it be a good idea to provide attributes for > > > mod/ref anaylsis ? > > > So sth like: > > > void foo(void) __attribute__((modifies(errno))); > > > which would state that foo modifies errno, but neither reads nor > > > modifies any other global var. > > > and > > > void bar(void) __attribute__((reads(errno))) > > > which would state that bar only reads errno, and doesn't modify > > > or > > > read any other global var. > > > > Many math.h functions are const except for possibly setting errno, > > possibly raising floating-point exceptions (which might have other > > effects > > when using alternate exception handling) and possibly reading the > > rounding > > mode.  To represent that, it might be useful for such attributes to > > be > > able to describe state (such as the floating-point environment) > > that > > doesn't correspond to a C identifier.  (errno tends to be a macro, > > so > > referring to it as such in an attribute may be awkward as well.) > > We need some way to describe these things in Gimple and RTL as well, > and not just on function calls: also on other expressions.  Adding > attributes that allow to describe this (partially, only per function) > in > C source code does not bring us closer to where we need to be. Right, but those IR concerns are orthogonal to the needs of the patch kit, which is a way to express certain *other* things per-function in the C frontend.   As noted in my other replies, this thread seems to be turning into something of a scope-creep pile-on, when I have some specific things I need for the rest of the patch kit, and they're unrelated to the problems of errno or floating-point handling. Dave