This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Java patch: Re: gcj producing bad code
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- To: Per Bothner <per at bothner dot com>
- Cc: Nic Ferrier <nferrier at tapsellferrier dot co dot uk>, java at gcc dot gnu dot org, java-patches at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sun, 07 Apr 2002 15:33:13 +1200
- Subject: Java patch: Re: gcj producing bad code
- References: <87d6xddb12.fsf@pooh-sticks-bridge.tapsellferrier.co.uk> <3CAE5E37.20206@waitaki.otago.ac.nz> <87y9g0c30y.fsf@pooh-sticks-bridge.tapsellferrier.co.uk> <3CAF1A5E.9E1841B3@email.byu.edu> <87vgb4bdtk.fsf@pooh-sticks-bridge.tapsellferrier.co.uk> <3CAF8956.6040309@bothner.com>
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;