public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c-family: Improve MEM_REF printing for diagnostics [PR98597]
Date: Thu, 14 Jan 2021 11:09:20 +0100	[thread overview]
Message-ID: <20210114100920.GW1034503@tucnak> (raw)
In-Reply-To: <nycvar.YFH.7.76.2101141103380.17979@zhemvz.fhfr.qr>

On Thu, Jan 14, 2021 at 11:05:40AM +0100, Richard Biener wrote:
> > > Could we print
> > > t.u.b
> > > if the TBAA type is compatible with the type of the reference and perhaps
> > > *(int*)&t.u.b
> > > if it is incompatible?
> > > >From the aliasing perspective that is still different, but we don't print
> > > the TBAA type anyway.
> 
> True.  As said we could simply add a GCC extension to write a MEM_REF
> in source and print that syntax ... then it would be valid (GCC) C/C++.

But even if we do that unless people are familiar with that extension they
wouldn't know what it means (and they didn't write it in that way in their
source).

> > There is another option I forgot about, but perhaps it is too verbose.
> > Print
> > *(int*)((char*)&t + offsetof (struct T, u.b))
> 
> or rather offsetof (struct T, u) to not single out a specific union
> member?

Sure, I can just get rid of the UNION_TYPE handling from the function,
or use it only if the TBAA access type is compatible.

	Jakub


  reply	other threads:[~2021-01-14 10:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13 19:11 Jakub Jelinek
2021-01-14  7:43 ` Richard Biener
2021-01-14  8:28   ` Jakub Jelinek
2021-01-14  8:34     ` Jakub Jelinek
2021-01-14 10:05       ` Richard Biener
2021-01-14 10:09         ` Jakub Jelinek [this message]
2021-01-14 10:17           ` Richard Biener
2021-01-14 17:49   ` Martin Sebor
2021-01-14 18:26     ` [PATCH] c-family, v2: " Jakub Jelinek
2021-01-15  8:58       ` Jakub Jelinek
2021-01-15 10:46         ` Richard Biener
2021-01-15 10:43       ` Richard Biener

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=20210114100920.GW1034503@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /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).