[Bug c/99826] New: GIMPLE FE fails to grok pointer declarators

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 30 09:58:15 GMT 2021


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).


More information about the Gcc-bugs mailing list