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.129.124]) by sourceware.org (Postfix) with ESMTPS id DB6FC384474B for ; Wed, 10 Apr 2024 17:36:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB6FC384474B 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 DB6FC384474B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712770580; cv=none; b=XiFyvsi+NEOQiZR4gn3GaNv3gs8hEHMRoZk+otbd6GoA3jkZ7or0Lpgtx8HAE2G952oJgDWo8PR+D2qqK98LgOOOOJB1smSsPXA9jcn9zb3slFJ8ndC6EZgvOA62NYCvkmIZWuGH8W6QILghCoCbLw3sysXetjX/puAbhp6CLAw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712770580; c=relaxed/simple; bh=NiB6oJ4+25iYWkj9AU4BwS7AWhItbqKflE8ppq5PhWc=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=S2tnnTzXfUQ3NO9oPgv3XtROBoFn4YTvS4LPTzldALCahKFQcteFNvpiwAkAfoO4JmXQJ17e5sclV+lipynazG+TgEqRZv5zEjJQ2+EbkNNR8IJnnfxOpcMjzr+BvjhuWFv3GTKB7PF1OvlhnCAQvMKaO2ZcdUwkPE7L73CoeDQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712770568; 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=eVt2dNqNl3BdA/ZJQhE4dtZhUQXQOUtPTpRVcs1Y+2g=; b=VGFZ2yPnsP7YgoI2Q98q5XyCcYWKMBcvxKnrA7b+NAwneyzdzW5v7gP2pAgLxHPHBeRcDW xPpyITEPYaET1WTz3qFiA0YV60eyA9p5oJSQosCnX5ZdlsR/Et8sToSgKBwMY/WfWjLqe0 Mmnlr1wI8GyXO6eab35L7tXunGyeQ5I= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-317-RL7sMrmgNE2e0zBR4nGMzQ-1; Wed, 10 Apr 2024 13:36:07 -0400 X-MC-Unique: RL7sMrmgNE2e0zBR4nGMzQ-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-513e7ff16a8so5801668e87.1 for ; Wed, 10 Apr 2024 10:36:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712770565; x=1713375365; 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=eVt2dNqNl3BdA/ZJQhE4dtZhUQXQOUtPTpRVcs1Y+2g=; b=anPNPiUFQ50HkzpkKps+WqLu1O2+84ug9hJyFd1JAWJQy3Phz+hOdrk73zMNC+JpLb 5yIlq7tVhpfirKETXlbixEkTWYtdsEJn65/BJdcMmDtjxI022hAvSgcORDu19Zu70KIM VWKUpHo0LDbvmR+ZoIao4Gp0awwjbEJzhQ93tFvC7CT8D4GQgPfUbIMsYROg5sJOOlJU 43kwcvVhuk+6Ybmd3UfA2sZh9M31bZp1PWN3qxLqr6QoA/OfFU+PnqVwfQoP+ot9xEn9 2x+SuIQMa8uJ+xjALYjGxIjhgs1uJeNqLfevEKB+HwjlYS4N6OvKeEV6NXhjlr0gPoj0 ScRQ== X-Forwarded-Encrypted: i=1; AJvYcCUI2mxDApjtDGczF+dAf5JIphgkRTsSnI6ZHGzHPMZdOqLWyBFc5TKHvYL1TAuVgczen85RJZI3F06cklyLbRbl4wX0vPuc2A== X-Gm-Message-State: AOJu0YzPMv3wDAquWvA1e9Xy43mfAXDBLNFHAJqiE59OqxbLwvkIAn/Q DdXX/wTGnHB4AeWrRsF/p6R2FiN/0Py3fsov43L52C/B/fVTPheb91JTP2E5vX+yYU/gYZzB2ME 2s3WHHjWW7QUUrJ/mm0wAHnEQBfjtRI69rWHIZvjGqMo0FmNXVGCvXi8= X-Received: by 2002:a05:6512:484d:b0:513:ec32:aa7b with SMTP id ep13-20020a056512484d00b00513ec32aa7bmr1979172lfb.63.1712770565577; Wed, 10 Apr 2024 10:36:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IESYAJ30lINUY1KZdFIiyc5/925s4c+xhEi2dyIViOp5xjZScg3WIrHjD92qF4s0IsDIqc/mA== X-Received: by 2002:a05:6512:484d:b0:513:ec32:aa7b with SMTP id ep13-20020a056512484d00b00513ec32aa7bmr1979151lfb.63.1712770565101; Wed, 10 Apr 2024 10:36:05 -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 n8-20020a5d4c48000000b0033e7b05edf3sm14198500wrt.44.2024.04.10.10.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 10:36:04 -0700 (PDT) Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.95) (envelope-from ) id 1rubrB-00CANI-2x; Wed, 10 Apr 2024 17:35:33 +0000 Date: Wed, 10 Apr 2024 17:35:33 +0000 (UTC) From: Joseph Myers To: Qing Zhao cc: richard.guenther@gmail.com, siddhesh@gotplt.org, uecker@tugraz.at, keescook@chromium.org, 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: <20240329160703.4012941-2-qing.zhao@oracle.com> Message-ID: References: <20240329160703.4012941-1-qing.zhao@oracle.com> <20240329160703.4012941-2-qing.zhao@oracle.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII 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: On Fri, 29 Mar 2024, Qing Zhao wrote: > + /* Issue error when there is a counted_by attribute with a different > + field as the argument for the same flexible array member field. */ There's another case of this to consider, though I'm not sure where best to check for it (Martin might have suggestions) - of course this case will need testcases as well. Suppose, as allowed in C23, a structure is defined twice in the same scope, but the two definitions of the structure use inconsistent counted_by attributes. I'd say that, when the declarations are in the same scope (thus required to be consistent), it should be an error for the two definitions of what is meant to be the same structure to use incompatible counted_by attributes (even though the member declarations are otherwise the same). In C23 structures defined with the same tag in different scopes are compatible given requirements including compatible types for corresponding elements. It would seem most appropriate to me for such structures with incompatible counted_by attributes to be considered *not* compatible types (but it would be valid to define structures with the same tag, different scopes, and elements the same except for counted_by - just not to use them in any way requiring them to be compatible). > +The @code{counted_by} attribute may be attached to the C99 flexible array > +member of a structure. It indicates that the number of the elements of the > +array is given by the field "@var{count}" in the same structure as the As noted previously, the "" quotes should be removed there (or replaced by ``'' quotes). -- Joseph S. Myers josmyers@redhat.com