aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2012-03-30 09:13:48 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2012-03-30 11:13:48 +0200
commit2fa3b955566afe73ae85644fd4287ca1de6ea3f6 (patch)
treeaff413668a7734d838b8121c2a79be3b05f60a35
parent702d139e260512c2bc3bcee7def3d5fe22d8ab22 (diff)
downloadgcc-2fa3b955566afe73ae85644fd4287ca1de6ea3f6.zip
gcc-2fa3b955566afe73ae85644fd4287ca1de6ea3f6.tar.gz
gcc-2fa3b955566afe73ae85644fd4287ca1de6ea3f6.tar.bz2
lib-xref-alfa.adb (Add_Alfa_File): Take into account possible absence of compilation unit for unit in Sdep_Table.
2012-03-30 Yannick Moy <moy@adacore.com> * lib-xref-alfa.adb (Add_Alfa_File): Take into account possible absence of compilation unit for unit in Sdep_Table. From-SVN: r185997
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/lib-xref-alfa.adb16
2 files changed, 17 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index baeff68..2a09d66 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-30 Yannick Moy <moy@adacore.com>
+
+ * lib-xref-alfa.adb (Add_Alfa_File): Take into account possible absence
+ of compilation unit for unit in Sdep_Table.
+
2012-03-30 Thomas Quinot <quinot@adacore.com>
* freeze.adb (Freeze_Record_Type): For a type with reversed bit
diff --git a/gcc/ada/lib-xref-alfa.adb b/gcc/ada/lib-xref-alfa.adb
index 4961fed..588213c 100644
--- a/gcc/ada/lib-xref-alfa.adb
+++ b/gcc/ada/lib-xref-alfa.adb
@@ -226,8 +226,14 @@ package body Alfa is
From := Alfa_Scope_Table.Last + 1;
- Traverse_Compilation_Unit (Cunit (U), Detect_And_Add_Alfa_Scope'Access,
- Inside_Stubs => False);
+ -- Unit U might not have an associated compilation unit, as seen in code
+ -- filling Sdep_Table in Write_ALI.
+
+ if Present (Cunit (U)) then
+ Traverse_Compilation_Unit (Cunit (U),
+ Detect_And_Add_Alfa_Scope'Access,
+ Inside_Stubs => False);
+ end if;
-- Update scope numbers
@@ -279,9 +285,11 @@ package body Alfa is
Get_Name_String (Reference_Name (S));
File_Name := new String'(Name_Buffer (1 .. Name_Len));
- -- For subunits, also retrieve the file name of the unit
+ -- For subunits, also retrieve the file name of the unit. Only do so if
+ -- unit U has an associated compilation unit.
- if Present (Cunit (Unit (S)))
+ if Present (Cunit (U))
+ and then Present (Cunit (Unit (S)))
and then Nkind (Unit (Cunit (Unit (S)))) = N_Subunit
then
Get_Name_String (Reference_Name (Main_Source_File));