------- Comment #7 from rguenther at suse dot de 2009-07-31 09:19 ------- Subject: Re: [4.5 Regression] FAIL: StackTrace2 output - source compiled test
On Thu, 30 Jul 2009, aph at gcc dot gnu dot org wrote: > ------- Comment #6 from aph at gcc dot gnu dot org 2009-07-30 17:24 ------- > This seems to be happening very early, because the very first tree dump shows: > > StackTrace2$Inner.doCrash(java.lang.Object) (struct StackTrace2$Inner * this, > struct java.lang.Object * o) > [StackTrace2.java : 0:0] { > struct java.lang.Object * #ref#2#2.146; > struct > { > struct java.lang.Class * class; > void * methods[2]; > } * D.1837; > void * * D.1838; > void * D.1839; > struct java.lang.String * java.lang.Object::<Tb5> (struct java.lang.Object > *) > * D.1840; > > [StackTrace2.java : 34:0] { > void * #ref#1#0; > struct java.lang.Object * D.252; > void * #ref#2#2; > > [StackTrace2.java : 33:0] D.252 = o; > [StackTrace2.java : 34:0] #ref#2#2 = D.252; > [StackTrace2.java : 34:0] #ref#2#2.146 = (struct java.lang.Object *) > #ref#2#2; > [StackTrace2.java : 34:0] D.1837 = #ref#2#2.146->vtable; > [StackTrace2.java : 34:0] D.1838 = &D.1837->methods[4]; > ... > > All this code should be marked as Line 33, not line 34. I don't know > why this has changed recently. Could it be now that all the java_replace_references is done at a different time we fail to properly update / copy locations in that function? I don't see that it changed really, and nothing uses locators there before or after the patch, but ... certainly the MODIFY_EXPR doesn't get its location copied from the original one. So, maybe the following would make a difference? (untested) Index: decl.c =================================================================== --- decl.c (revision 150221) +++ decl.c (working copy) @@ -361,9 +361,10 @@ java_replace_references (tree *tp, int * tree new_lhs = java_replace_reference (lhs, /* want_lvalue */ true); tree new_rhs = build1 (NOP_EXPR, TREE_TYPE (new_lhs), TREE_OPERAND (*tp, 1)); - *tp = build2 (MODIFY_EXPR, TREE_TYPE (new_lhs), - new_lhs, new_rhs); - *tp = build1 (NOP_EXPR, TREE_TYPE (lhs), *tp); + tree tem = build2 (MODIFY_EXPR, TREE_TYPE (new_lhs), + new_lhs, new_rhs); + SET_EXPR_LOCATION (tem, EXPR_LOCATION (*tp)); + *tp = build1 (NOP_EXPR, TREE_TYPE (lhs), tem); } } if (TREE_CODE (*tp) == VAR_DECL) Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40867