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 c/99826] New: GIMPLE FE fails to grok pointer declarators
Date: Tue, 30 Mar 2021 09:58:15 +0000	[thread overview]
Message-ID: <bug-99826-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 99826
           Summary: GIMPLE FE fails to grok pointer declarators
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

char * __GIMPLE(ssa) foo(char *p)
{
  char *_2;

__BB(2):
  _2 = p_1(D);
  return _2;
}

shows two issues, first the return type declaration causes __GIMPLE to be
not associated with the function, failing it to parse at all.  Fixing that
using a typedef shows that we fail to parse the SSA declaration 'char *_2'
as SSA name declaration because we have

      /* Handle SSA name decls specially, they do not go into the identifier
         table but we simply build the SSA name for later lookup.  */
      unsigned version, ver_offset;
      if (declarator->kind == cdk_id
          && is_gimple_reg_type (specs->type)

but declarator is

$5 = {kind = cdk_pointer, id_loc = 0, declarator = 0x3775200, u = {id = {
      id = <tree 0x0>, attrs = <tree 0x0>}, arg_info = 0x0, array = {
      dimen = <tree 0x0>, quals = 0, attrs = <tree 0x0>, static_p = 0, 
      vla_unspec_p = 0}, pointer_quals = 0, attrs = <tree 0x0>}}

in this case.  It looks like we need to unwrap cdk_pointer at least
(and build the actual pointer type in the SSA case).  The "early-out"
case for SSA names tries to avoid start_decl and building a decl
(and registering it in the binding for future lookup).

             reply	other threads:[~2021-03-30  9:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30  9:58 rguenth at gcc dot gnu.org [this message]
2021-03-30 12:59 ` [Bug c/99826] " rguenth at gcc dot gnu.org
2024-03-08  5:13 ` pinskia 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-99826-4@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).