public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/99826] New: GIMPLE FE fails to grok pointer declarators
@ 2021-03-30  9:58 rguenth at gcc dot gnu.org
  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
  0 siblings, 2 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-30  9:58 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/99826] GIMPLE FE fails to grok pointer declarators
  2021-03-30  9:58 [Bug c/99826] New: GIMPLE FE fails to grok pointer declarators rguenth at gcc dot gnu.org
@ 2021-03-30 12:59 ` rguenth at gcc dot gnu.org
  2024-03-08  5:13 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-30 12:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
__GIMPLE(ssa) char * foo(char *p) {..}

works for the first issue.  I failed to make the "late" __GIMPLE spec work in
a straight-forward manner.  I guess we might want to change the default dumping
to prefer the above order.

The 2nd issue remains and can be seen as

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

  <bb 2> :
  _2_2 = p_1(D);
  return _2_2;

}

fixing it in a generic way will likely require exposing more of grokdeclarator
and eventually generating the SSA name there directly.  Limited support
is possible of course and the workaround is to declare a decl:

  char * q;

__BB(2):
  q_2 = p_1(D);
  return q_2;

which will work at the expense of creating a decl.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/99826] GIMPLE FE fails to grok pointer declarators
  2021-03-30  9:58 [Bug c/99826] New: GIMPLE FE fails to grok pointer declarators rguenth at gcc dot gnu.org
  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
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-08  5:13 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-03-08
     Ever confirmed|0                           |1
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The first issue of the placement __GIMPLE(ssa) is still there.
The second issue of _2 was fixed in GCC 12.

Confirmed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-08  5:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30  9:58 [Bug c/99826] New: GIMPLE FE fails to grok pointer declarators rguenth at gcc dot gnu.org
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

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