public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aldyh at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/102605] New: address instruction from -fdump-tree-*-gimple doesn't work with -fgimple
Date: Tue, 05 Oct 2021 09:48:08 +0000	[thread overview]
Message-ID: <bug-102605-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 102605
           Summary: address instruction from -fdump-tree-*-gimple doesn't
                    work with -fgimple
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aldyh at gcc dot gnu.org
            Blocks: 101057
  Target Milestone: ---

The following snippet:

$ cat y.c
void bar();

char global[10];

void foo(char *p)
{
  if (&global[2] == p)
    bar();
}

...when converted to GIMPLE:

$ ./cc1 y.c -fdump-tree-ssa-gimple -quiet
$ cat y.c.022t.ssa 
void __GIMPLE (ssa)
foo (char * p)
{
  __BB(2):
  if (p_2(D) == &global[2])
    goto __BB3;
  else
    goto __BB4;

  __BB(3):
  bar ();
  goto __BB4;

  __BB(4):
  return;

}

Does not compile with -fgimple:

$ mv y.c.022t.ssa z.c

$ ./cc1 z.c -fgimple -quiet
z.c: In function ‘foo’:
z.c:5:17: error: expected expression before ‘&’ token
    5 |   if (p_2(D) == &global[2])
      |                 ^
z.c: At top level:
z.c:5:27: error: expected identifier or ‘(’ before ‘)’ token
    5 |   if (p_2(D) == &global[2])
      |                           ^
z.c:7:3: error: expected identifier or ‘(’ before ‘else’
    7 |   else
      |   ^~~~
z.c:10:8: error: expected declaration specifiers or ‘...’ before numeric
constant
   10 |   __BB(3):
      |        ^
z.c:12:3: error: expected identifier or ‘(’ before ‘goto’
   12 |   goto __BB4;
      |   ^~~~
z.c:14:8: error: expected declaration specifiers or ‘...’ before numeric
constant
   14 |   __BB(4):
      |        ^
z.c:17:1: error: expected identifier or ‘(’ before ‘}’ token
   17 | }
      | ^

Is the output from -fdump-tree-*-gimple suppose to be compilable by -fgimple? 
If not, what is the appropriate way of representing &global[2] in the gimple
FE?


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101057
[Bug 101057] [gimplefe] GIMPLE frontend issues

             reply	other threads:[~2021-10-05  9:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05  9:48 aldyh at gcc dot gnu.org [this message]
2021-10-05 12:16 ` [Bug other/102605] " rguenth at gcc dot gnu.org
2021-10-05 14:14 ` aldyh at gcc dot gnu.org
2021-10-05 14:37 ` cvs-commit at gcc dot gnu.org
2021-10-06  6:11 ` rguenther at suse dot de
2021-10-06  7:40 ` aldyh at redhat dot com
2021-10-06  8:13 ` rguenther at suse dot de
2021-10-06  8:28 ` aldyh at redhat dot com
2021-10-06 10:02 ` cvs-commit at gcc dot gnu.org
2021-10-07  6:21 ` rguenth 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-102605-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).