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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E5D8C433FE for ; Thu, 13 Oct 2022 19:37:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbiJMThW (ORCPT ); Thu, 13 Oct 2022 15:37:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229651AbiJMThW (ORCPT ); Thu, 13 Oct 2022 15:37:22 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9ACD165523 for ; Thu, 13 Oct 2022 12:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665689840; 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; bh=jVovCSzH+8utlFay2NdxOUG1pH0EjSKl/qJoAZkz6d8=; b=PZgMfrFng3lQj06Tg70g8Pju9JpCPoTJxYa5GaJwxRFKh+yLmP7+J4yDYOo0j31E+z14wx 7HdoVdVj77CLqtd/KtucNgKFQNeWDp/M5YAuLqiDhElYsbLxA/lLlppW57n6+vW1JibVOF PUsTtEIxOTN6DmvAWWlmx0ixR81Wu1g= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-510-G8dpAXCMOkmon8KRmjM_pg-1; Thu, 13 Oct 2022 15:37:19 -0400 X-MC-Unique: G8dpAXCMOkmon8KRmjM_pg-1 Received: by mail-qv1-f70.google.com with SMTP id g12-20020a0cfdcc000000b004ad431ceee0so2251222qvs.7 for ; Thu, 13 Oct 2022 12:37:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:content-transfer-encoding:date:cc:to:from :subject:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jVovCSzH+8utlFay2NdxOUG1pH0EjSKl/qJoAZkz6d8=; b=nywfHUNrVptu++NtG+gFyGes8U6ntOESRdgvFtSZJ+nYXstz8k2B2fG2Hl0E0KRIOF AVTTrwbuWvdWka+g3Pm5c8sdIvbErziEGeTAT2TTPepvyrleFq8NXWjR81XDdETSkOMB ZYClAaPJuSTS/j2oAiE0IDAqx70WJiGeLKX0usllDH4pMcMwKS2FerCO2Oy3mMFpEs20 p3lSqcexQHZPPuW06rTDKMNdjWyw3yHjJl1pIkYZK1beGZbPIF8d32HRRn+R2qRm+Suc 33yw6X3pcunSEqSwV/9jieTaGDTDjmORBuzlQE1j7oFkqE+OrhfEmvvrl1mWAveuDOgd FScw== X-Gm-Message-State: ACrzQf2h/2/C7j3hYQXH4bmlqT9QNtaiwomQlnEGQ8pAdE1PTUn3gHf8 /DCDocD4Q4zowSfDnndK86n4eQMVAOLVp++z5BdhywPqlYP8/Pk0YRcqJFrx9aQYbBB8cbZX5cy RBwqviAsZa/gRkJu6mP9ujMHln9ET9Q== X-Received: by 2002:a05:620a:25d4:b0:6bb:f596:97d0 with SMTP id y20-20020a05620a25d400b006bbf59697d0mr1219922qko.411.1665689838533; Thu, 13 Oct 2022 12:37:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6jT7X/pAKPYmyq2AJLKB1fDw7rmMhDXAhwYk6OKFW2I0QGn7qealSkzWwxBXG0wwg1CEeHgw== X-Received: by 2002:a05:620a:25d4:b0:6bb:f596:97d0 with SMTP id y20-20020a05620a25d400b006bbf59697d0mr1219898qko.411.1665689838307; Thu, 13 Oct 2022 12:37:18 -0700 (PDT) Received: from t14s.localdomain (c-73-69-212-193.hsd1.ma.comcast.net. [73.69.212.193]) by smtp.gmail.com with ESMTPSA id ay39-20020a05620a17a700b006ed30a8fb21sm490071qkb.76.2022.10.13.12.37.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 12:37:17 -0700 (PDT) Message-ID: Subject: address_space and noderef on non-pointer types From: David Malcolm To: linux-sparse@vger.kernel.org, linux-toolchains@vger.kernel.org Cc: David Faust , Julia Lawall , "Jose E. Marchesi" , Elena Zannoni Date: Thu, 13 Oct 2022 15:37:16 -0400 User-Agent: Evolution 3.44.4 (3.44.4-1.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org Is it valid to apply the sparse attributes 'noderef' or 'address_space' to non-pointers, and if so, what does this mean? I see examples of using them on non-pointers in sparse's own test suite. For example, in: https://git.kernel.org/pub/scm/devel/sparse/sparse.git/tree/validation/type= -attribute-as.c "struct s" is annotated with __attribute__((address_space(__as))) Similarly, there's https://git.kernel.org/pub/scm/devel/sparse/sparse.git/tree/validation/node= ref.c#n18 where sparse accepts: struct x __A x; e.g.: struct x __attribute__((noderef)) x; The docs for noderef:=20 https://git.kernel.org/pub/scm/devel/sparse/sparse.git/tree/Documentation/a= nnotations.rst#n54 say: "This attribute is to be used on a r-value to specify it cannot be dereferenced. A pointer so annotated is in all other aspects exactly like a pointer but trying to actually access anything through it will cause a warning." What is the intended meaning of "noderef" for a non-pointer? Similarly, the docs for "address_space" say: "This attribute is to be used on pointers to specify that its target is in address space *name* (an identifier or a constant integer)." but don't specify what it means to use in on a non-pointer. Sorry if this is a silly question. The background here is that I'm a GCC developer and have been experimenting with implementing some sparse attributes and warnings "natively" in GCC; see e.g. the RFE in GCC bugzilla for implementing address_space, noderef and force here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D59850 ; I'm trying to get my patched GCC to handle Sparse's own test suite and hence running into this issue. Thanks Dave