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 F1720393C848 for ; Wed, 10 Apr 2024 18:44:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F1720393C848 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 F1720393C848 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=1712774670; cv=none; b=ZxHNj2j0OefSeGQEVrVEfzz/M3Zc9ehURWB7xfDX1FKLsMKUonKLCZ+v91HuaYNb83At+AL04xoKW4D11+FNqUr3H4DeeKEiU5kcqIWl82eE6V3HwuQ8ng4ni0eXssv4BrBfzX6h5E6pMujHK7bIvoJ60yQ3s4zt97nFnVf/pks= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712774670; c=relaxed/simple; bh=1z9tsDy64gYeGieR0gaZ9xIM8QXRhLgx4x2Noc9nckA=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=dju78FVTIM2yOHLpcrclgOE5nauWBPy8LMFgxDKE2FeqiXKHgFDMuzyyCZ+mgj5cPSBWxAQx658eySJAxq3QYuz256D0aXQEnFcZ3Ixjde6odUTInqGCGu5v6BIGfWsaeHfZOUeeGLpAMUBglW7YAvJBsI7Wy2mwJsN2np2ZYLA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712774651; 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=OheWU1GbvkpPdhTbwM+PFyz7Zyl6g0xeeVHn0Wm+K4k=; b=fSCL5iGScWsMlOQONAAfbTaNt68d+RLbos/hDUrHp4miDZu8DvznhHMIAdZ36ToJa+RN/y xfHyhfpCtPJ8td+q3Iq/3Gxyj0GlgndzAarILzdKNxbzdusaOVQ3lThHFDX/PmaPAZys6Z egXTQtB0Hkfwp8DRBbDE5as5tZD2/UM= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-63-f3E75en9OfeBPTTwr76qIw-1; Wed, 10 Apr 2024 14:44:09 -0400 X-MC-Unique: f3E75en9OfeBPTTwr76qIw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-41485831b2dso52633985e9.3 for ; Wed, 10 Apr 2024 11:44:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712774648; x=1713379448; 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=OheWU1GbvkpPdhTbwM+PFyz7Zyl6g0xeeVHn0Wm+K4k=; b=Wconeffn3XIlD6Q6m4KeW+d91dlhlZHUt5sxqhwmjLaS2evWQcWb4CwH5ZiTz+yPQo 5y1e0hgAfDp0+7BNPsDLgTzNo5XE878opk4Pne6RSEPMYhvb8Ke7AVSkpebmbVcwS0Qb TIpExYfOxbra0MT6Yk/5dBZcZt/x+C0C/bmDrfQBhvE8Pxn+FnwRrAHA7fbjGw6x1FVb gv60PALZOK00JRkPHYc4LtF9DjbwrGsftCXbCVWO1RgC6hJgIiwqhhrK1y8cTfVD+T5M W0mlG/bZrOI2heqO13O8uCfuot6R9uwhp8XQYHzZdhhQ3EadiJn/3ICKticyCncHvLiI K6xA== X-Forwarded-Encrypted: i=1; AJvYcCWzBKkdYKJLOUQi9Qj0VtvFbSSS3RBKFJiraHpb1I43KYLQ8e8Iny+JJ5pt+QjlKjhz4meg6tkPsc+GxfR4hlFtYBmKQn3tZw== X-Gm-Message-State: AOJu0YxL+RCYzsxgt12668fBS0ZvoOly/mS3o7RX8357e1LLoWk+0G5o ErsHcGwwusYrKI78vgvhebmvIOMwKqtMqQ/b85CaqK20+hEuSuRaCLzjXrfHfl3sELrkeHXHZJA r99u9DpfS7/S/Nhs7gh1UwVDCqehPB76GroC1/ciRQSTi3hU7LOE4PFs= X-Received: by 2002:a05:600c:4fce:b0:416:a71e:f2b6 with SMTP id o14-20020a05600c4fce00b00416a71ef2b6mr3067242wmq.8.1712774648210; Wed, 10 Apr 2024 11:44:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGTGuFUfqxFFrOohYOblzbd1X/N/Fek/cGVUxBmIEha/e2ffbCqd3AjAwdIIvfDUSH98dSQg== X-Received: by 2002:a05:600c:4fce:b0:416:a71e:f2b6 with SMTP id o14-20020a05600c4fce00b00416a71ef2b6mr3067225wmq.8.1712774647876; Wed, 10 Apr 2024 11:44:07 -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 o5-20020a05600c510500b0041668770f37sm3115008wms.17.2024.04.10.11.44.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 11:44:07 -0700 (PDT) Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.95) (envelope-from ) id 1rucvW-00CBKo-D1; Wed, 10 Apr 2024 18:44:06 +0000 Date: Wed, 10 Apr 2024 18:44:06 +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: <7CF58725-81D3-4A6B-BC9C-C828155FA399@oracle.com> Message-ID: <96f7663d-8475-6b5a-dc46-3483dc3079a2@redhat.com> References: <20240329160703.4012941-1-qing.zhao@oracle.com> <20240329160703.4012941-2-qing.zhao@oracle.com> <7CF58725-81D3-4A6B-BC9C-C828155FA399@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 Wed, 10 Apr 2024, Qing Zhao wrote: > A stupid question first, the same scope means the same file? (Or same function) struct X { int a; }; struct X { int a; }; is an example of the same scope (file scope, in this case). The structures must have the same contents (in an appropriate sense) and are then considered the same type. struct X { int a; }; void f() { struct X { int a; }; } is not the same scope - but C23 makes the types compatible (not the same). It's OK to have incompatible types with the same tag in different scopes as well struct X { int a; }; void f() { struct X { long b; }; } but if you use them in a way requiring compatibility, then the contents must be compatible struct X { int a; } v; void f() { struct X { int a; } *p = &v; } > Is there a testing case for this feature in current GCC source tree I can take a look? (and > Then I can use it to construct the new testing case for the counted-by attribute). See gcc.dg/c23-tag-*.c for many tests of different cases involving the tag compatibility rules (and gcc.dg/gnu23-tag-* where GNU extensions are involved). -- Joseph S. Myers josmyers@redhat.com