public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <richard.guenther@gmail.com>
To: Jason Merrill <jason@redhat.com>
Cc: Richard Guenther <rguenther@suse.de>,
	gcc-patches List <gcc-patches@gcc.gnu.org>, GCC <gcc@gcc.gnu.org>
Subject: Re: Is VIEW_CONVERT_EXPR an lvalue? (was Re: RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10)))
Date: Sun, 12 Jun 2011 13:22:00 -0000	[thread overview]
Message-ID: <BANLkTimPmATmemAUMTD9Ty_=0y1ctx=ZvQ@mail.gmail.com> (raw)
In-Reply-To: <BANLkTin8o9=mfL80u_MaWMSDyCYa61vdpQ@mail.gmail.com>

On Sun, Jun 12, 2011 at 12:59 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sat, Jun 11, 2011 at 10:01 PM, Jason Merrill <jason@redhat.com> wrote:
>> On 06/10/2011 10:20 AM, Richard Guenther wrote:
>>>
>>> no, a VIEW_CONVERT_EXPR is generally not an lvalue (fold for example
>>> would turn the above to (volatile int) a[1]).
>>
>> The gimplifier seems to consider it an lvalue: gimplify_expr uses
>> gimplify_compound_lval for it, and gimplify_addr_expr handles taking its
>> address.  And get_inner_reference handles it.  So I think fold should be
>> changed, and we should clarify that VIEW_CONVERT_EXPR is an lvalue.
>>
>> If not, we need a new tree code for treating an lvalue as an lvalue of a
>> different type without having to take its address; that's what I thought
>> VIEW_CONVERT_EXPR was for.

Btw, see tree.def which says

/* Represents viewing something of one type as being of a second type.
   This corresponds to an "Unchecked Conversion" in Ada and roughly to
   the idiom *(type2 *)&X in C.  The only operand is the value to be
   viewed as being of another type.  It is undefined if the type of the
   input and of the expression have different sizes.

   This code may also be used within the LHS of a MODIFY_EXPR, in which
   case no actual data motion may occur.  TREE_ADDRESSABLE will be set in
   this case and GCC must abort if it could not do the operation without
   generating insns.  */
DEFTREECODE (VIEW_CONVERT_EXPR, "view_convert_expr", tcc_reference, 1)

> The please provide a specification on what a VIEW_CONVERT_EXPR does
> to type-based alias analysis.  We are trying to avoid that by the rvalue rule.
> Also you can always avoid VIEW_CONVERT_EXPRs for lvalues by simply
> moving the conversion to the rvalue side.
>
> Yes, we do handle lvalue VIEW_CONVERT_EXPRs, but that is for Ada
> which uses it for aggregates.  I don't want us to add more lvalue
> VIEW_CONVERT_EXPR
> cases, especially not for register types.
>
> Richard.
>
>> Jason
>>
>

  reply	other threads:[~2011-06-12 11:03 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07  5:39 RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10)) Jason Merrill
2011-06-07 10:20 ` Richard Guenther
2011-06-07 10:27   ` Jakub Jelinek
2011-06-07 12:03     ` Richard Guenther
2011-06-07 12:22       ` Richard Guenther
2011-06-07 13:46         ` Michael Matz
2011-06-07 13:49           ` Richard Guenther
2011-06-07 13:55   ` Jason Merrill
2011-06-07 14:05     ` Richard Guenther
2011-06-07 14:24       ` Jason Merrill
2011-06-09 19:47         ` Jason Merrill
2011-06-10  8:53           ` Richard Guenther
2011-06-10 14:03             ` Jason Merrill
2011-06-10 14:20               ` Richard Guenther
2011-06-10 14:32                 ` Jason Merrill
2011-06-10 14:34                   ` Richard Guenther
2011-06-10 14:45                     ` Jason Merrill
2011-06-11 18:24                     ` Mike Stump
2011-06-12 11:03                       ` Richard Guenther
2011-06-13  7:29                         ` Mike Stump
2011-06-13 12:46                           ` Richard Guenther
2011-06-14 20:31                             ` Mike Stump
2011-06-15  9:54                               ` Richard Guenther
2011-06-15 18:57                                 ` Mike Stump
2011-06-16  7:39                                   ` Richard Guenther
2011-06-17 14:17                                     ` Michael Matz
2011-06-20 10:24                                       ` Richard Guenther
2011-06-12  7:58                     ` Is VIEW_CONVERT_EXPR an lvalue? (was Re: RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10))) Jason Merrill
2011-06-12 13:18                       ` Richard Guenther
2011-06-12 13:22                         ` Richard Guenther [this message]
2011-06-13  6:12                           ` Mike Stump
2011-06-12 22:42                         ` Jason Merrill
2011-06-13 12:44                           ` Richard Guenther
2011-06-13 17:59                             ` RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10)) Jason Merrill
2011-06-14  9:10                               ` Richard Guenther

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='BANLkTimPmATmemAUMTD9Ty_=0y1ctx=ZvQ@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=rguenther@suse.de \
    /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).