aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-09-28 09:09:41 +0200
committerEric Botcazou <ebotcazou@adacore.com>2020-09-28 09:32:27 +0200
commitcc997e0cc4fcc9ae8e389757d94a0ae69d34cd50 (patch)
treee3da8016f11ae01d8e93cdc8acdd6a171e048cdf /gcc/ada/gcc-interface
parent88795e14ae7143bd8039af68d2d876ae34568799 (diff)
downloadgcc-cc997e0cc4fcc9ae8e389757d94a0ae69d34cd50.zip
gcc-cc997e0cc4fcc9ae8e389757d94a0ae69d34cd50.tar.gz
gcc-cc997e0cc4fcc9ae8e389757d94a0ae69d34cd50.tar.bz2
Add missing end location information
In some cases we would fail to put the end location information on the outermost BIND_EXPR of a function, which is problematic when there is a dynamic stack allocation. gcc/ada/ChangeLog: * gcc-interface/trans.c (Subprogram_Body_to_gnu): Set the end locus of body and declaration earlier.
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r--gcc/ada/gcc-interface/trans.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 3491451..f03d591 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -4017,6 +4017,11 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
gnat_poplevel ();
gnu_result = end_stmt_group ();
+ /* Attempt setting the end_locus of our GCC body tree, typically a BIND_EXPR,
+ then the end_locus of our GCC subprogram declaration tree. */
+ set_end_locus_from_node (gnu_result, gnat_node);
+ set_end_locus_from_node (gnu_subprog_decl, gnat_node);
+
/* If we populated the parameter attributes cache, we need to make sure that
the cached expressions are evaluated on all the possible paths leading to
their uses. So we force their evaluation on entry of the function. */
@@ -4111,12 +4116,6 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
gnu_return_label_stack->pop ();
- /* Attempt setting the end_locus of our GCC body tree, typically a
- BIND_EXPR or STATEMENT_LIST, then the end_locus of our GCC subprogram
- declaration tree. */
- set_end_locus_from_node (gnu_result, gnat_node);
- set_end_locus_from_node (gnu_subprog_decl, gnat_node);
-
/* On SEH targets, install an exception handler around the main entry
point to catch unhandled exceptions. */
if (DECL_NAME (gnu_subprog_decl) == main_identifier_node