aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/exp_util.adb7
-rw-r--r--gcc/ada/sem_util.adb35
3 files changed, 38 insertions, 11 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index ca3de2d..6220a7e 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2015-03-02 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_util.adb (Possible_Bit_Aligned_Component): Do not process
+ an unanalyzed node.
+ * sem_util.adb (Kill_Current_Values): Do not invalidate and
+ de-null a constant.
+
2015-03-02 Robert Dewar <dewar@adacore.com>
* sem_ch3.adb, exp_attr.adb, checks.adb, exp_aggr.adb: Minor
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index aa835ad..a565e7f 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -6938,6 +6938,13 @@ package body Exp_Util is
function Possible_Bit_Aligned_Component (N : Node_Id) return Boolean is
begin
+ -- Do not process an unanalyzed node because it is not yet decorated and
+ -- most checks performed below will fail.
+
+ if not Analyzed (N) then
+ return False;
+ end if;
+
case Nkind (N) is
-- Case of indexed component
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index d9ab705..2ea04d7 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -13012,20 +13012,33 @@ package body Sem_Util is
Kill_Checks (Ent);
Set_Current_Value (Ent, Empty);
- if not Can_Never_Be_Null (Ent) then
- Set_Is_Known_Non_Null (Ent, False);
- end if;
+ -- Do not reset the Is_Known_[Non_]Null and Is_Known_Valid flags
+ -- for a constant. Once the constant is elaborated, its value is
+ -- not changed, therefore the associated flags that describe the
+ -- value should not be modified either.
- Set_Is_Known_Null (Ent, False);
+ if Ekind (Ent) = E_Constant then
+ null;
- -- Reset Is_Known_Valid unless type is always valid, or if we have
- -- a loop parameter (loop parameters are always valid, since their
- -- bounds are defined by the bounds given in the loop header).
+ -- Non-constant entities
- if not Is_Known_Valid (Etype (Ent))
- and then Ekind (Ent) /= E_Loop_Parameter
- then
- Set_Is_Known_Valid (Ent, False);
+ else
+ if not Can_Never_Be_Null (Ent) then
+ Set_Is_Known_Non_Null (Ent, False);
+ end if;
+
+ Set_Is_Known_Null (Ent, False);
+
+ -- Reset the Is_Known_Valid flag unless the type is always
+ -- valid. This does not apply to a loop parameter because its
+ -- bounds are defined by the loop header and therefore always
+ -- valid.
+
+ if not Is_Known_Valid (Etype (Ent))
+ and then Ekind (Ent) /= E_Loop_Parameter
+ then
+ Set_Is_Known_Valid (Ent, False);
+ end if;
end if;
end if;
end if;