This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Java patch: Re: gcj producing bad code
Per Bothner wrote:
> I suspect the problem is that the variable 'from_super' isn't
> being reset in resolve_qualified_expression_name. Alex?
Right. resolve_qualified_expression_name iterates through each element
in a WFL, setting the from_super flag if it sees a "super.". But in the
case of a "super" qualified method call it forgets to clear the flag
before it is done, so in the case of:
super.getX().getY()
the getY() is treated as if it were a "super" call also, and is emitted
as a non-virtual call when it should not be.
The patch below fixes the problem. I'm testing it now. OK to commit
assuming no problems?
regards
Bryce.
2002-04-07 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* parse.y (resolve_qualified_expression_name): Clear "from_super" flag
after using it to patch CALL_EXPR.
Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.370
diff -u -r1.370 parse.y
--- parse.y 1 Apr 2002 08:46:07 -0000 1.370
+++ parse.y 7 Apr 2002 03:08:24 -0000
@@ -9462,6 +9462,7 @@
*where_found = patch_method_invocation (qual_wfl, decl, type,
from_super,
&is_static, &ret_decl);
+ from_super = 0;
if (*where_found == error_mark_node)
{
RESTORE_THIS_AND_CURRENT_CLASS;