aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2023-02-10 16:28:41 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-05-22 10:46:12 +0200
commit7434fb666749964aef4ae9de85848ed52cb18f32 (patch)
treed69caef18fa21892d1fe0959c98c3c69311d3c35 /gcc
parentcf0d1f43ae471104a6120a8d1f89851974f8e27b (diff)
downloadgcc-7434fb666749964aef4ae9de85848ed52cb18f32.zip
gcc-7434fb666749964aef4ae9de85848ed52cb18f32.tar.gz
gcc-7434fb666749964aef4ae9de85848ed52cb18f32.tar.bz2
ada: Fix source location for crashes in expanded Loop_Entry attributes
Historically, Loop_Entry attributes were expanded while expanding their corresponding loops, so it was easier to use location of these loops for expanded code. Now, these attributes are expanded where they appear, so we can easily use the location of the attribute reference for expanded code. This matters when there is a crash in the expanded code, e.g. because of a stack overflow in the declaration of an constant object that captures the Loop_Entry prefix. Now backtrace will point to the source location of the attribute, which is more helpful than the location of the loop. gcc/ada/ * exp_attr.adb (Expand_Loop_Entry_Attribute): Use location of the attribute reference, not of the loop statement.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_attr.adb10
1 files changed, 4 insertions, 6 deletions
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 7e71422..a5791ad 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -1354,14 +1354,14 @@ package body Exp_Attr is
-- Local variables
- Pref : constant Node_Id := Prefix (N);
- Base_Typ : constant Entity_Id := Base_Type (Etype (Pref));
- Exprs : constant List_Id := Expressions (N);
+ Pref : constant Node_Id := Prefix (N);
+ Base_Typ : constant Entity_Id := Base_Type (Etype (Pref));
+ Exprs : constant List_Id := Expressions (N);
+ Loc : constant Source_Ptr := Sloc (N);
Aux_Decl : Node_Id;
Blk : Node_Id := Empty;
Decls : List_Id;
Installed : Boolean;
- Loc : Source_Ptr;
Loop_Id : Entity_Id;
Loop_Stmt : Node_Id;
Result : Node_Id := Empty;
@@ -1402,8 +1402,6 @@ package body Exp_Attr is
Loop_Id := Entity (Identifier (Loop_Stmt));
end if;
- Loc := Sloc (Loop_Stmt);
-
-- Step 2: Transform the loop
-- The loop has already been transformed during the expansion of a prior