From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 53269384476F for ; Wed, 10 Apr 2024 21:56:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 53269384476F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 53269384476F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712786199; cv=none; b=k/I8ggzEOvMAgLNL9Vp//T44KHa/5vhg5Shj+p/hfFUSRm1xlle3icUO/2gss22qYmWmPq9Q5EEtOI8P5wxt/b3DKn63gzYf6dR8mHGozHCfmjVo8I7AeJpXOBDfuJOKjW3riZXZVe+hAEpfH1QW6iWl4XCrFN2pfE3yB08rAso= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712786199; c=relaxed/simple; bh=xl3Ps9emRJmU2byrEPk9nJNuVPtsMuDf+NYlzWriVLU=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=cZrbQyuGDD3quOVxvImIvy7N/l7mP5LG/c8VBOuaQ7pGT/4+YSz2y2zLRh0xoZCVzDmdCQrgoYqptK2EC26tJLYbXbl4QEhhwv2qCCqWxxo6kLbNbh6evmbCujj6mXJFtZKCtBn+ZUC5nzIJhGoJSqIeiOu2ye+wmZYa705fz7c= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712786188; 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: in-reply-to:in-reply-to:references:references; bh=Bp3j/3zFJLZbgQNK3gQzN6teQWv5yy7KTZuN1RxOPJ4=; b=BjpnD0PGstclZeB7DJZwKaPRuegcj25I2qB7bbuq67vqt75F66Nblx2FJZ8ZhAIsF/rEXd 5129t77js2TfaYsBgAp0d6JjmaP8aOGdJpUP8ALurVfb/hWB6wvkf/nqItWy5MCULY9Vfv oNyJmZzul2s446m8xkv/Lik+f3/CvOg= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-460-6rKZpVktM_-9_NgDktsLzw-1; Wed, 10 Apr 2024 17:56:27 -0400 X-MC-Unique: 6rKZpVktM_-9_NgDktsLzw-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-346b8ef7e10so17121f8f.3 for ; Wed, 10 Apr 2024 14:56:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712786186; x=1713390986; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=V4/Pg9IhBf25YFlQjuvHjXr6WwX3MtDWYlNWSkdSb4w=; b=vYzSPUFFTVrh6eBwVn+IaPuTI7lS0BfHwP+UI/z5q432IeCBqPPuKuJlm0+ZPF4fVN w+xRV5K9dqioHcliA4uO/QT+hAgymY2DFE8pqx2gmgLb6LsUfKZVyG/PPicB/Y4upNYQ GcezmnkdlEAguEhj/oB9grzuSccNoRKdxvyRce7aZ9BUHXA1MlWXH2g15VUDFa26Sf3G S1ifH9NdXwWxbv95PiEZqZ+0zGfbVCv3bAtWCXFXeY/K/FYZeO5pRdu5z2J+Qvdr4TeW WLsoqpcrggZnnuIKx47Tgxh2ITHDQxQGjns4plFOk+0lRvJk2Daa07KGE4/QgarKPflj YXSQ== X-Forwarded-Encrypted: i=1; AJvYcCXm3WQ33Zjda/XSw6BdWhbv0cqIIZJgRaqGsnNFUHTeJdS0cn/SOzcR/MXZ6oufS9kThXBqRny8zho0ZV8LZWrMgNE8Khommg== X-Gm-Message-State: AOJu0YwB3OjTSLKh9xBFbYSnv+s9M0J7aKF87rBW8MGbXPF5IDjaeZWG ofj2qyv8OhNIQhrMO3GOOinS6nFgnvS+Ln905Ul1kCbnRDw4JPzAqKvcl2J4cAY9HD0nINZVOiW 2hBx9hurFgHed1fUmkKv4ZoiwI6yEe33y+aQIACKGhfHeD/qJZvGoA3I= X-Received: by 2002:a5d:598a:0:b0:343:b942:312a with SMTP id n10-20020a5d598a000000b00343b942312amr4475134wri.7.1712786186148; Wed, 10 Apr 2024 14:56:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLkQHfprp2Z1FAJTGk41fkJCl+7VYHR5F3kxiwaHV61KYTo2cOaOtZEqCalbe12gHQ5gJrzQ== X-Received: by 2002:a5d:598a:0:b0:343:b942:312a with SMTP id n10-20020a5d598a000000b00343b942312amr4475119wri.7.1712786185758; Wed, 10 Apr 2024 14:56:25 -0700 (PDT) Received: from digraph.polyomino.org.uk (digraph.polyomino.org.uk. [2001:8b0:bf73:93f7::51bb:e332]) by smtp.gmail.com with ESMTPSA id e28-20020adf9bdc000000b00343b252b096sm198883wrc.23.2024.04.10.14.56.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 14:56:25 -0700 (PDT) Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.95) (envelope-from ) id 1rufvc-00CD6u-2y; Wed, 10 Apr 2024 21:56:24 +0000 Date: Wed, 10 Apr 2024 21:56:24 +0000 (UTC) From: Joseph Myers To: Qing Zhao cc: "uecker@tugraz.at" , Richard Biener , Siddhesh Poyarekar , Kees Cook , "isanbard@gmail.com" , "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH v8 1/5] Provide counted_by attribute to flexible array member field (PR108896) In-Reply-To: <554BC0FC-2DAD-4FE8-939B-4D1510D4F2F0@oracle.com> Message-ID: <86cb5563-1289-e6ee-b95f-914286a8718c@redhat.com> References: <20240329160703.4012941-1-qing.zhao@oracle.com> <20240329160703.4012941-2-qing.zhao@oracle.com> <7CF58725-81D3-4A6B-BC9C-C828155FA399@oracle.com> <96f7663d-8475-6b5a-dc46-3483dc3079a2@redhat.com> <554BC0FC-2DAD-4FE8-939B-4D1510D4F2F0@oracle.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="-1152306461-1475678547-1712786184=:2847235" X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1152306461-1475678547-1712786184=:2847235 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Wed, 10 Apr 2024, Qing Zhao wrote: > Okay, the above is very clear, thanks a lot for the explanation. > So, basically, for “counted-by” attribute: > **The following is good: > struct f { > int b; > int c; > int a[] __attribute__ ((counted_by (b))) }; > struct f { > int b; > int c; > int a[] __attribute__ ((counted_by (b))) }; > > **The following should error: > > struct f { > int b; > int c; > int a[] __attribute__ ((counted_by (b))) }; > struct f { > int b; > int c; > int a[] __attribute__ ((counted_by (c))) }; /* error here */ > > For the same tag in different scopes case: > > struct f { > int b; > int c; > int a[] __attribute__ ((counted_by (b))) } y0; > > void test1(void) > { > struct f { > int b; > int c; > int a[] __attribute__ ((counted_by (c))) } x; > > y0 = x; /* will report incompatible type error here */ > } > > Are the above complete? Yes, that looks like what should be tested (with the addition of the case of same tag, different scopes, same counted_by so compatible). -- Joseph S. Myers josmyers@redhat.com ---1152306461-1475678547-1712786184=:2847235--