public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mark at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/20103] [4.0/4.1 regression] ICE in create_tmp_var with C99 style struct initializer
Date: Mon, 07 Mar 2005 18:05:00 -0000	[thread overview]
Message-ID: <20050307180525.10729.qmail@sourceware.org> (raw)
In-Reply-To: <20050220111234.20103.falk@debian.org>


------- Additional Comments From mark at codesourcery dot com  2005-03-07 18:05 -------
Subject: Re: [PR c++/20103] failure to gimplify constructors for addressable
 types

Alexandre Oliva wrote:
> On Mar  7, 2005, Mark Mitchell <mark@codesourcery.com> wrote:
> 
> 
>>Are you sure that we can use TARGET_EXPR as a type-conversion node?
> 
> 
> Actually, no.  I was led to believe so because there is a function
> that creates a TARGET_EXPR given an initializer and a type, in
> addition to the one that takes the type from the initializer.

OK, so if there's no conversion, then my suggestion (i.e., copy the type 
from the substituted initializer) should work fine.

> I was thinking references, actually, so there wouldn't be a
> constructor involved.  I.e., I was trying to preserve the earlier
> behavior of TARGET_EXPRs (i.e., mostly do nothing with them), while
> adjusting the behavior only as much as needed for this new use.

TARGET_EXPRs create objects.  I'm not sure if we ever create 
TARGET_EXPRs with REFERENCE_TYPE, but if so, there initializers should 
have the same type.

>>Then we really should do that. 
> 
> Eek.  What for?  All we need to do is adjust its type.  A new tree
> node scattered all over the place feels like way too much overhead for
> this.

There are two situations:

1. The type is derivable from the operands.

In that case, you can do that, as I've suggested above, by creating the 
operands, and then applying a *uniform, unconditional* operation to the 
type of the operands to determine the type of the TARGET_EXPR.

2. The type is not derivable from the operands.

In that case, you should be going through the same semantics.c routines 
that we do at parse time.

The truth is that (2) is a better choice no matter what, because we 
really want dependent expressions to have a representation that is very 
nearly isomorphic to the source code.  We have to introduce nodes 
corresponding to G++ extensions in other places (like 
statement-expressions); this is no different.  However, I can live with 
(1), for expediency sake.

>>The games that you want to play with type-equality are just too fragile.
> 
> I still don't see why.

First, you're using "==".  As I've told you, that's incredibly fragile. 
  You're depending on a very non-local property that in the case that 
you're interested in, the types will always be ==.  But, minor changes 
elsewhere might make them same_type_p, but not ==, in some cases.  Then, 
your code breaks, probably undetectably.  To a first approximation, the 
only place == should be used for types is in same_type_p itself.

Second, you're applying a non-uniform manipulation on the types of the 
TARGET_EXPR, based on a non-local property about how TARGET_EXPRs are 
created, without actually checking that the condition you're interested 
in (incomplete array types) applies.

This is not an approach that's going to be robust over time.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20103


  parent reply	other threads:[~2005-03-07 18:05 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-20 17:37 [Bug c++/20103] New: [4.0 regression] ICE in create_tmp_var falk at debian dot org
2005-02-20 17:52 ` [Bug c++/20103] " falk at debian dot org
2005-02-20 19:02 ` pinskia at gcc dot gnu dot org
2005-02-20 19:25 ` pinskia at gcc dot gnu dot org
2005-02-20 19:27 ` pinskia at gcc dot gnu dot org
2005-02-21 21:49 ` pinskia at gcc dot gnu dot org
2005-02-23 11:10 ` [Bug c++/20103] [4.0 regression] ICE in create_tmp_var with C99 style struct initializer pinskia at gcc dot gnu dot org
2005-03-02 13:48 ` [Bug c++/20103] [4.0/4.1 " reichelt at gcc dot gnu dot org
2005-03-03  7:01 ` aoliva at gcc dot gnu dot org
2005-03-03  7:42 ` aoliva at redhat dot com
2005-03-04 23:22 ` aoliva at redhat dot com
2005-03-04 23:30 ` mark at codesourcery dot com
2005-03-05 11:41 ` giovannibajo at libero dot it
2005-03-05 12:16 ` joseph at codesourcery dot com
2005-03-05 13:37 ` aoliva at redhat dot com
2005-03-05 14:03 ` aoliva at redhat dot com
2005-03-05 21:47 ` mark at codesourcery dot com
2005-03-06  7:30 ` aoliva at redhat dot com
2005-03-06 18:02 ` mark at codesourcery dot com
2005-03-07  3:26 ` aoliva at redhat dot com
2005-03-07  4:44 ` mark at codesourcery dot com
2005-03-07  8:51 ` giovannibajo at libero dot it
2005-03-07 14:44 ` aoliva at redhat dot com
2005-03-07 16:05 ` mark at codesourcery dot com
2005-03-07 17:05 ` aoliva at redhat dot com
2005-03-07 18:05 ` mark at codesourcery dot com [this message]
2005-03-07 21:58 ` aoliva at redhat dot com
2005-03-07 22:39 ` mark at codesourcery dot com
2005-03-08  7:25 ` aoliva at redhat dot com
2005-03-08  7:46 ` mark at codesourcery dot com
2005-03-08 20:44 ` aoliva at redhat dot com
2005-03-08 21:55 ` aoliva at redhat dot com
2005-03-11 15:20 ` rth at gcc dot gnu dot org
2005-03-11 19:29 ` aoliva at redhat dot com
2005-03-17 10:42 ` aoliva at redhat dot com
2005-03-17 11:49 ` rth at gcc dot gnu dot org
2005-03-18  5:39 ` aoliva at redhat dot com
2005-03-18 10:16 ` aoliva at redhat dot com
2005-04-02 17:27 ` aoliva at redhat dot com
2005-04-05 14:47 ` pinskia at gcc dot gnu dot org
2005-04-17  3:57 ` mmitchel at gcc dot gnu dot org
2005-04-17  3:59 ` aoliva at redhat dot com
2005-04-17  4:03 ` mark at codesourcery dot com
2005-04-17  6:25 ` aoliva at redhat dot com
2005-07-06 17:03 ` mmitchel at gcc dot gnu dot org
2005-07-22 21:12 ` steven at gcc dot gnu dot org
2005-09-27 16:18 ` mmitchel at gcc dot gnu dot org
     [not found] <bug-20103-2744@http.gcc.gnu.org/bugzilla/>
2005-10-13 20:06 ` pinskia at gcc dot gnu dot org
2005-10-14 14:37 ` pinskia at gcc dot gnu dot org
2005-10-31  2:44 ` mmitchel at gcc dot gnu dot org
2006-05-25 20:26 ` mmitchel at gcc dot gnu dot org
2006-06-09  9:57 ` jakub at gcc dot gnu dot org
2006-06-10 22:23 ` pinskia at gcc dot gnu dot org
2006-07-03 23:52 ` tbm at cyrius dot com
2007-02-14  9:05 ` mmitchel at gcc dot gnu dot 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=20050307180525.10729.qmail@sourceware.org \
    --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).