aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2011-09-02 07:19:46 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2011-09-02 09:19:46 +0200
commited32b82e77377f2905fd1a2b74bff4b06d108ef2 (patch)
tree246908214390338ab86c11ccf753d0d7ed9c7292
parentf7bb41af65aa53933814ec82474497876d396b33 (diff)
downloadgcc-ed32b82e77377f2905fd1a2b74bff4b06d108ef2.zip
gcc-ed32b82e77377f2905fd1a2b74bff4b06d108ef2.tar.gz
gcc-ed32b82e77377f2905fd1a2b74bff4b06d108ef2.tar.bz2
sem_attr.adb: (Analyze_Attribute, case 'Range): when expanding X'range (N) into X'First (N) ..
2011-09-02 Ed Schonberg <schonberg@adacore.com> * sem_attr.adb: (Analyze_Attribute, case 'Range): when expanding X'range (N) into X'First (N) .. X'Last (N), do not share the dimension indicator N, if present. Even though it is a static constant, its source location may be modified when printing expanded code under -gnatDL, and node sharing will lead to chaos in Sprint on large files, by generating a sloc value that does not correspond to any source file. From-SVN: r178437
-rw-r--r--gcc/ada/ChangeLog10
-rw-r--r--gcc/ada/sem_attr.adb19
2 files changed, 26 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 8f63086..885cbad 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,13 @@
+2011-09-02 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_attr.adb: (Analyze_Attribute, case 'Range): when expanding
+ X'range (N) into X'First (N) .. X'Last (N), do not share the
+ dimension indicator N, if present. Even though it is a static
+ constant, its source location may be modified when printing
+ expanded code under -gnatDL, and node sharing will lead to chaos
+ in Sprint on large files, by generating a sloc value that does
+ not correspond to any source file.
+
2011-09-02 Bob Duff <duff@adacore.com>
* einfo.adb: (Has_Xref_Entry): Do not call
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index b3546c6..69963e4 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -8871,6 +8871,7 @@ package body Sem_Attr is
declare
LB : Node_Id;
HB : Node_Id;
+ Dims : List_Id;
begin
if not Is_Entity_Name (P)
@@ -8879,18 +8880,30 @@ package body Sem_Attr is
Resolve (P);
end if;
+ Dims := Expressions (N);
+
HB :=
Make_Attribute_Reference (Loc,
Prefix =>
Duplicate_Subexpr (P, Name_Req => True),
Attribute_Name => Name_Last,
- Expressions => Expressions (N));
+ Expressions => Dims);
LB :=
Make_Attribute_Reference (Loc,
- Prefix => P,
+ Prefix => P,
Attribute_Name => Name_First,
- Expressions => Expressions (N));
+ Expressions => (Dims));
+
+ -- Do not share the dimension indicator, if present. Even
+ -- though it is a static constant, its source location
+ -- may be modified when printing expanded code and node
+ -- sharing will lead to chaos in Sprint.
+
+ if Present (Dims) then
+ Set_Expressions (LB,
+ New_List (New_Copy_Tree (First (Dims))));
+ end if;
-- If the original was marked as Must_Not_Freeze (see code
-- in Sem_Ch3.Make_Index), then make sure the rewriting