This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ICE in inner class constructor.
- To: java at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Subject: Re: ICE in inner class constructor.
- From: Alexandre Petit-Bianco <apbianco at cygnus dot com>
- Date: Thu, 31 May 2001 16:07:23 -0700 (PDT)
- Cc: Per Bothner <per at bothner dot com>
- Cc: "Mark J. Roberts" <mjr at statesmean dot com>
- References: <Pine.LNX.4.32.0105251819160.793-100000@rm03-24-131-185-22.ce.mediaone.net><15119.27584.360819.315654@deliverance.cygnus.com><m2k834htnp.fsf@kelso.bothner.com><m2eltbj4lh.fsf@kelso.bothner.com>
- Reply-To: apbianco at cygnus dot com
Per Bothner writes:
> I think the compiler needs to be fixed so the library can build with
> this patch!
I'm checking this in the trunk and the branch in order to fix the
problem. Things where tested extensively. Your tree checking patch
could be checked in too.
> +#define EXPR_WFL_NODE(NODE) TREE_OPERAND(EXPR_WFL_CHECK (NODE), 0)
^-missing a space.
(Working properly with --enable-checking is a 3.0 criteria.)
./A
2001-05-31 Alexandre Petit-Bianco <apbianco@redhat.com>
* parse.y (lookup_field_wrapper): Test `name' code.
(resolve_qualified_expression_name): Test `qual_wfl' code.
(qualify_ambiguous_name): Handle `CONVERT_EXPR', fixe indentation,
handle `qual_wfl' by code.
(maybe_build_primttype_type_ref): Test `wfl' code.
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.251.2.28
diff -u -p -r1.251.2.28 parse.y
--- parse.y 2001/05/31 06:05:42 1.251.2.28
+++ parse.y 2001/05/31 18:18:06
@@ -4079,7 +4079,7 @@ lookup_field_wrapper (class, name)
/* Last chance: if we're within the context of an inner class, we
might be trying to access a local variable defined in an outer
context. We try to look for it now. */
- if (INNER_CLASS_TYPE_P (class))
+ if (INNER_CLASS_TYPE_P (class) && TREE_CODE (name) == IDENTIFIER_NODE)
{
tree new_name;
MANGLE_OUTER_LOCAL_VARIABLE_NAME (new_name, name);
@@ -9222,7 +9222,8 @@ resolve_qualified_expression_name (wfl,
previous_call_static = 0;
/* It can be the keyword THIS */
- if (EXPR_WFL_NODE (qual_wfl) == this_identifier_node)
+ if (TREE_CODE (qual_wfl) == EXPR_WITH_FILE_LOCATION
+ && EXPR_WFL_NODE (qual_wfl) == this_identifier_node)
{
if (!current_this)
{
@@ -9273,7 +9274,8 @@ resolve_qualified_expression_name (wfl,
}
/* 15.10.2 Accessing Superclass Members using SUPER */
- if (EXPR_WFL_NODE (qual_wfl) == super_identifier_node)
+ if (TREE_CODE (qual_wfl) == EXPR_WITH_FILE_LOCATION
+ && EXPR_WFL_NODE (qual_wfl) == super_identifier_node)
{
tree node;
/* Check on the restricted use of SUPER */
@@ -10854,6 +10856,10 @@ qualify_ambiguous_name (id)
else if (code == INTEGER_CST)
name = qual_wfl;
+ else if (code == CONVERT_EXPR &&
+ TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
+ name = TREE_OPERAND (qual_wfl, 0);
+
else if ((code == ARRAY_REF || code == CALL_EXPR || code == MODIFY_EXPR) &&
TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
@@ -10868,7 +10874,7 @@ qualify_ambiguous_name (id)
qual_wfl = QUAL_WFL (qual);
again = 1;
}
- else
+ else
{
name = EXPR_WFL_NODE (qual_wfl);
if (!name)
@@ -10896,8 +10902,10 @@ qualify_ambiguous_name (id)
qual_wfl = QUAL_WFL (qual);
if (TREE_CODE (qual_wfl) == CALL_EXPR)
again = 1;
- else
+ else if (TREE_CODE (qual_wfl) == EXPR_WITH_FILE_LOCATION)
name = EXPR_WFL_NODE (qual_wfl);
+ else if (TREE_CODE (qual_wfl) == NEW_CLASS_EXPR)
+ name = TREE_OPERAND (qual_wfl, 0);
this_found = 1;
}
/* If we have a SUPER, we set the context accordingly */
@@ -12418,6 +12426,7 @@ maybe_build_primttype_type_ref (rhs, wfl
if (TREE_CODE (n) == VAR_DECL
&& DECL_NAME (n) == TYPE_identifier_node
&& rhs_type == class_ptr_type
+ && TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION
&& TREE_CODE (EXPR_WFL_NODE (wfl)) == IDENTIFIER_NODE)
{
const char *self_name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl));