public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/106833] Handle OPAQUE_TYPE in gimple_canonical_types_compatible_p
Date: Mon, 05 Sep 2022 08:27:54 +0000	[thread overview]
Message-ID: <bug-106833-4-rlPBKDdwud@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106833-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106833

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> (In reply to Kewen Lin from comment #1)
> > IMHO this is an omission when we were adding supports for opaque type, const
> > __vector_quad and __vector_quad should be taken as
> > canonical_types_compatible.
> > 
> > I wonder if we can simply take it just like what it handles for
> > "Non-aggregate types", for example:
> > 
> > diff --git a/gcc/tree.cc b/gcc/tree.cc
> > index 2f488e4467c..555e96c59d5 100644
> > --- a/gcc/tree.cc
> > +++ b/gcc/tree.cc
> > @@ -13510,6 +13510,7 @@ gimple_canonical_types_compatible_p (const_tree t1,
> > const_tree t2,
> >        || TREE_CODE (t1) == VECTOR_TYPE
> >        || TREE_CODE (t1) == COMPLEX_TYPE
> >        || TREE_CODE (t1) == OFFSET_TYPE
> > +      || TREE_CODE (t1) == OPAQUE_TYPE
> >        || POINTER_TYPE_P (t1))
> >      {
> >        /* Can't be the same type if they have different recision.  */
> > 
> > Or adding one default hook which does the similar thing, and then if one
> > target needs some target specific checks on its opaque type, one specific
> > hook can be provided.
> 
> I'm quoting tree.def, emphasis mine:
> 
> /* This is for types that will use MODE_OPAQUE in the back end.  They are
> meant
>    to be able to go in a register of some sort but are _EXPLICITLY NOT TO BE
>    CONVERTED_ or operated on like INTEGER_TYPE.  They will have size and
>    alignment information only.  */
> DEFTREECODE (OPAQUE_TYPE, "opaque_type", tcc_type, 0)

Also the above says "have size and alignment information only" but the
path you patch will look at TYPE_PRECISION and signedness.  Why, if that
was necessary, did the TYPE_MODE check not trigger?

> so why should we care about special-casing them?  The target should have set
> TYPE_CANONICAL appropriately if necessary, why didn't it?  Btw, 'const'
> qualification should go into the type variant chain (well, for "normal"
> types), where TYPE_MAIN_VARIANT is the unqualified type variant. 
> TYPE_CANONICAL
> shouldn't come into play here.
> 
> Btw, the whole idea of "opaque" is a hack and it seems to backfire now?

  parent reply	other threads:[~2022-09-05  8:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05  8:01 [Bug middle-end/106833] New: " linkw at gcc dot gnu.org
2022-09-05  8:09 ` [Bug middle-end/106833] " linkw at gcc dot gnu.org
2022-09-05  8:25 ` rguenth at gcc dot gnu.org
2022-09-05  8:27 ` rguenth at gcc dot gnu.org [this message]
2022-09-05  9:26 ` linkw at gcc dot gnu.org
2022-09-05  9:29 ` linkw at gcc dot gnu.org
2022-09-05  9:58 ` rguenther at suse dot de
2022-09-05 16:25 ` segher at gcc dot gnu.org
2022-09-06  3:40 ` linkw at gcc dot gnu.org
2022-09-06 21:21 ` segher at gcc dot gnu.org
2022-09-07  4:28 ` linkw at gcc dot gnu.org
2022-09-07  4:31 ` [Bug middle-end/106833] Miss to handle OPAQUE_TYPE specially in verify_type linkw at gcc dot gnu.org
2022-09-07 13:08 ` segher at gcc dot gnu.org
2022-09-09 13:18 ` cvs-commit at gcc dot gnu.org
2022-09-14 12:43 ` linkw at gcc dot gnu.org
2022-09-14 12:53 ` bergner at gcc dot gnu.org
2022-09-14 13:50 ` linkw at gcc dot gnu.org

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=bug-106833-4-rlPBKDdwud@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).