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
This commit is contained in:
Eric Botcazou 2017-02-24 10:07:45 +00:00 committed by Eric Botcazou
parent bf6b72928e
commit 8ff873dcdc
2 changed files with 24 additions and 7 deletions

View File

@ -1,3 +1,16 @@
2017-02-24 Eric Botcazou <ebotcazou@adacore.com>
* 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 <ebotcazou@adacore.com>
* 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 <ebotcazou@adacore.com> 2017-02-24 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils.c (max_size) <tcc_expression>: Flip the second * gcc-interface/utils.c (max_size) <tcc_expression>: Flip the second

View File

@ -6,7 +6,7 @@
* * * *
* C Implementation File * * 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 * * 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- * * 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_result;
tree gnu_expr; tree gnu_expr;
Node_Id gnat_temp; 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 /* 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 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. */ /* When we exit this block, restore the saved value. */
add_cleanup (build_call_n_expr (set_jmpbuf_decl, 1, gnu_jmpsave_decl), 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 /* 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) if (at_end)
{ {
tree proc_decl = gnat_to_gnu (At_End_Proc (gnat_node)); tree proc_decl = gnat_to_gnu (At_End_Proc (gnat_node));
/* When not optimizing, disable inlining of finalizers as this can /* When not optimizing, disable inlining of finalizers as this can
create a more complex CFG in the parent function. */ create a more complex CFG in the parent function. */
if (!optimize) if (!optimize)
DECL_DECLARED_INLINE_P (proc_decl) = 0; 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. /* Now build the tree for the declarations and statements inside this block.