This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: java instance initializers



Jeff Sturm writes:

> If a java class contains instance initializers called through a
> constructor invoking `this', the initializers are executed twice:

Good catch. Thanks.

> The patch below fixes this bug and passes the libgcj testsuite.  OK
> for trunk?

Yes.

> @@ -8544,6 +8545,9 @@
>  	  {
>  	  case CALL_EXPR:
>  	    found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
> +	    if (EXPR_WFL_NODE (TREE_OPERAND (body, 0)) == 
> +		  this_identifier_node)
> +	      invokes_this = 1;
>  	    body = NULL_TREE;
>  	    break;
>  	  case COMPOUND_EXPR:

I would just say:

>  	  {
>  	  case CALL_EXPR:
>  	    found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
> +         invokes_this = CALL_THIS_CONSTRUCTOR_P (body)
>  	    body = NULL_TREE;
>  	    break;
>  	  case COMPOUND_EXPR:

./A


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]