+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
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
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;