From: Eric Botcazou Date: Fri, 24 Feb 2017 10:07:45 +0000 (+0000) Subject: trans.c (Handled_Sequence_Of_Statements_to_gnu): If there is no end label... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8ff873dcdc0b87cbb30a1a951384293cc2d15a41;p=gcc.git trans.c (Handled_Sequence_Of_Statements_to_gnu): If there is no end label... * gcc-interface/trans.c (Handled_Sequence_Of_Statements_to_gnu): If there is no end label, put the location of the At_End procedure on the call to the procedure. From-SVN: r245699 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a7edb4158cc..4b60b3e69df 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2017-02-24 Eric Botcazou + + * gcc-interface/trans.c (Handled_Sequence_Of_Statements_to_gnu): If + there is no end label, put the location of the At_End procedure on + the call to the procedure. + +2017-02-24 Eric Botcazou + + * gcc-interface/misc.c (gnat_type_max_size): Try to return a meaningful + value for array types with TYPE_INDEX_TYPE set on their domain type. + * gcc-interface/utils.c (max_size): For operations and expressions, do + not build a new node if the operands have not changed or are missing. + 2017-02-24 Eric Botcazou * gcc-interface/utils.c (max_size) : Flip the second diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index e5047f0de46..7cde2306480 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2016, Free Software Foundation, Inc. * + * Copyright (C) 1992-2017, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -4965,10 +4965,6 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) tree gnu_result; tree gnu_expr; Node_Id gnat_temp; - /* Node providing the sloc for the cleanup actions. */ - Node_Id gnat_cleanup_loc_node = (Present (End_Label (gnat_node)) ? - End_Label (gnat_node) : - gnat_node); /* The GCC exception handling mechanism can handle both ZCX and SJLJ schemes and we have our own SJLJ mechanism. To call the GCC mechanism, we call @@ -5018,7 +5014,8 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) /* When we exit this block, restore the saved value. */ add_cleanup (build_call_n_expr (set_jmpbuf_decl, 1, gnu_jmpsave_decl), - gnat_cleanup_loc_node); + Present (End_Label (gnat_node)) + ? End_Label (gnat_node) : gnat_node); } /* If we are to call a function when exiting this block, add a cleanup @@ -5027,11 +5024,18 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) if (at_end) { tree proc_decl = gnat_to_gnu (At_End_Proc (gnat_node)); + /* When not optimizing, disable inlining of finalizers as this can create a more complex CFG in the parent function. */ if (!optimize) DECL_DECLARED_INLINE_P (proc_decl) = 0; - add_cleanup (build_call_n_expr (proc_decl, 0), gnat_cleanup_loc_node); + + /* If there is no end label attached, we use the location of the At_End + procedure because Expand_Cleanup_Actions might reset the location of + the enclosing construct to that of an inner statement. */ + add_cleanup (build_call_n_expr (proc_decl, 0), + Present (End_Label (gnat_node)) + ? End_Label (gnat_node) : At_End_Proc (gnat_node)); } /* Now build the tree for the declarations and statements inside this block.