public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/102605] address instruction from -fdump-tree-*-gimple doesn't work with -fgimple
Date: Wed, 06 Oct 2021 08:13:41 +0000	[thread overview]
Message-ID: <bug-102605-4-QMMI3AJGjO@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102605-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 6 Oct 2021, aldyh at redhat dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102605
> 
> --- Comment #5 from Aldy Hernandez <aldyh at redhat dot com> ---
> > > BTW, the __MEM_REF output from the dumps does not work in -fgimple either.
> > > More errors.
> >
> > Can you share an example?
> 
> This is from gcc.c-torture/execute/961125-1.c compiled with -fgimple:
> 
> char * begfield (int tab, char * ptr, char * lim, int sword, int schar);
> 
> int __GIMPLE (ssa)
> main ()
> {
>   char * lim;
>   char * s;
>   char * _1;
> 
>   __BB(2):
>   _1 = begfield (58, ":ab", &__MEM <char[4]> ((void *)":ab" + _Literal
> (void *) 3), 1, 1);

OK, here we're eliding the & before the ":ab" in duming, so it should
read

  _1 = begfield (58, ":ab", &__MEM <char[4]> ((void *)&":ab" + _Literal 
(void *) 3), 1, 1);

>   if (_1 != &__MEM <char[4]> ((void *)":ab" + _Literal (void *) 2))
>     goto __BB3;

Likewise here, and the patch I'm testing should fix the missing _Literal:

  if (_1 != _Literal (char *) &__MEM <char[4]> ((void *)&":ab" + _Literal 
(void *) 2))

then there needs to be an adjustment to the C frontend to allow
MEM_REFs as lvalue:

diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index f9eb0e5176f..efe70511b91 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -4969,6 +4969,8 @@ lvalue_p (const_tree ref)
       return true;

     case INDIRECT_REF:
+    case MEM_REF:
+    case TARGET_MEM_REF:
     case ARRAY_REF:
     case VAR_DECL:
     case PARM_DECL:

Then the code is accepted.

Btw, please report cases where -gimple doesn't produce valid GIMPLE FE
inputs (OK, there are known cases with mangled symbol names when
passes create temporaries whose name includes a '.' for example...)

  parent reply	other threads:[~2021-10-06  8:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05  9:48 [Bug other/102605] New: " aldyh at gcc dot gnu.org
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 [this message]
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-QMMI3AJGjO@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).