public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joseph Myers <josmyers@redhat.com>
To: Qing Zhao <qing.zhao@oracle.com>
Cc: "uecker@tugraz.at" <uecker@tugraz.at>,
	 Richard Biener <richard.guenther@gmail.com>,
	 Siddhesh Poyarekar <siddhesh@gotplt.org>,
	 Kees Cook <keescook@chromium.org>,
	 "isanbard@gmail.com" <isanbard@gmail.com>,
	 "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v8 1/5] Provide counted_by attribute to flexible array member field (PR108896)
Date: Wed, 10 Apr 2024 18:44:06 +0000 (UTC)	[thread overview]
Message-ID: <96f7663d-8475-6b5a-dc46-3483dc3079a2@redhat.com> (raw)
In-Reply-To: <7CF58725-81D3-4A6B-BC9C-C828155FA399@oracle.com>

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


  reply	other threads:[~2024-04-10 18:44 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29 16:06 [PATCH v8 0/5] New attribute "counted_by" to annotate bounds for C99 FAM(PR108896) Qing Zhao
2024-03-29 16:06 ` [PATCH v8 1/5] Provide counted_by attribute to flexible array member field (PR108896) Qing Zhao
2024-04-10 17:35   ` Joseph Myers
2024-04-10 18:05     ` Qing Zhao
2024-04-10 18:44       ` Joseph Myers [this message]
2024-04-10 19:21         ` Qing Zhao
2024-04-10 21:56           ` Joseph Myers
2024-04-11 13:17             ` Qing Zhao
2024-04-10 18:25     ` Martin Uecker
2024-04-10 19:05       ` Martin Uecker
2024-04-10 19:35         ` Qing Zhao
2024-04-11  6:02           ` Martin Uecker
2024-04-11 13:16             ` Qing Zhao
2024-03-29 16:07 ` [PATCH v8 2/5] Convert references with "counted_by" attributes to/from .ACCESS_WITH_SIZE Qing Zhao
2024-04-10 18:36   ` Joseph Myers
2024-04-10 19:38     ` Qing Zhao
2024-04-11 13:27     ` Qing Zhao
2024-03-29 16:07 ` [PATCH v8 3/5] Use the .ACCESS_WITH_SIZE in builtin object size Qing Zhao
2024-04-10 21:45   ` Siddhesh Poyarekar
2024-04-11 13:19     ` Qing Zhao
2024-03-29 16:07 ` [PATCH v8 4/5] Use the .ACCESS_WITH_SIZE in bound sanitizer Qing Zhao
2024-04-10 18:37   ` Joseph Myers
2024-04-10 21:46   ` Siddhesh Poyarekar
2024-04-11 13:22     ` Qing Zhao
2024-03-29 16:07 ` [PATCH v8 5/5] Add the 6th argument to .ACCESS_WITH_SIZE Qing Zhao
2024-04-10 18:38   ` Joseph Myers
2024-04-10 21:48   ` Siddhesh Poyarekar
2024-04-11 13:24     ` Qing Zhao
2024-03-29 18:09 ` [PATCH v8 0/5] New attribute "counted_by" to annotate bounds for C99 FAM(PR108896) Tom Tromey
2024-03-29 19:16   ` Kees Cook
2024-03-29 19:58     ` Qing Zhao
2024-03-30  0:16       ` Tom Tromey
2024-03-30  0:15     ` Tom Tromey
2024-03-30 13:57 ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96f7663d-8475-6b5a-dc46-3483dc3079a2@redhat.com \
    --to=josmyers@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=isanbard@gmail.com \
    --cc=keescook@chromium.org \
    --cc=qing.zhao@oracle.com \
    --cc=richard.guenther@gmail.com \
    --cc=siddhesh@gotplt.org \
    --cc=uecker@tugraz.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).