This is the mail archive of the 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]
Other format: [Raw text]

Re: try_finally_expr wrong source location info

> But then, after lowering on the eh pass (gcc/tree-eh.c:1161), the "finally"
> location is set up to the `gimple_location (tf->try_finally_expr)' which
> actually expands to "testcase.cxx:4", a place where the "try" block starts.
> The dump testcase.cxx.009t.ehopt shows no location info for destructor:
>  std::unique_ptr<char>::~unique_ptr (&lang);
> And next dump shows equal location for constructor and
> destructor:
>  [testcase.cxx:4:38] std::unique_ptr<char>::unique_ptr ([testcase.cxx:4:38]
> &lang, D.42272); [testcase.cxx:4:38] std::unique_ptr<char>::~unique_ptr
> (&lang);
> I performed several experiments trying to get information about gimple_block
> around the try_finally_expr statement right in `lower_try_finally_onedest',
> but unsuccessfully. And also, as far as I understand, this issue should be
> fixed in all the lowering functions, not only this one.
> Where should I dig in order to fix the issue?

We have been using this patchlet locally for some time:

Index: tree-eh.c
--- tree-eh.c   (revision 248944)
+++ tree-eh.c   (working copy)
@@ -1413,11 +1413,12 @@ lower_try_finally_switch (struct leh_sta
       x = gimple_build_assign (finally_tmp,
                               build_int_cst (integer_type_node,
+      gimple_set_location (x, finally_loc);
       gimple_seq_add_stmt (&tf->top_p_seq, x);
       tmp = build_int_cst (integer_type_node, fallthru_index);
       last_case = build_case_label (tmp, NULL,
-                                   create_artificial_label (tf_loc));
+                                   create_artificial_label (finally_loc));
       case_label_vec.quick_push (last_case);
@@ -1426,7 +1427,7 @@ lower_try_finally_switch (struct leh_sta
       tmp = lower_try_finally_fallthru_label (tf);
       x = gimple_build_goto (tmp);
-      gimple_set_location (x, tf_loc);
+      gimple_set_location (x, finally_loc);
       gimple_seq_add_stmt (&switch_body, x);
Eric Botcazou

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