summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch5.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-16 12:20:32 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-16 12:20:32 +0000
commit63cca77baf4322d3530064095608986ee14907d8 (patch)
treec6e23196fb0dab9c3d4e73d751df4d212ed98e21 /gcc/ada/sem_ch5.adb
parent325876edfdaff8a5e9e89f22f6bf0fdd50908426 (diff)
downloadgcc-63cca77baf4322d3530064095608986ee14907d8.tar.gz
2007-08-16 Robert Dewar <dewar@adacore.com>
* sem_ch5.adb (Analyze_Assignment): Make sure we still note update in exception case git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127548 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch5.adb')
-rw-r--r--gcc/ada/sem_ch5.adb15
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index abc3d8231b1..9282b3f5c0a 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -574,22 +574,31 @@ package body Sem_Ch5 is
Analyze_And_Resolve (Rhs, T1);
end if;
- -- Ada 2005 (AI-231)
+ -- Ada 2005 (AI-231): Assignment to not null variable
if Ada_Version >= Ada_05
and then Can_Never_Be_Null (T1)
and then not Assignment_OK (Lhs)
then
+ -- Case where we know the right hand side is null
+
if Known_Null (Rhs) then
Apply_Compile_Time_Constraint_Error
(N => Rhs,
Msg => "(Ada 2005) null not allowed in null-excluding objects?",
Reason => CE_Null_Not_Allowed);
+
+ -- We still mark this as a possible modification, that's necessary
+ -- to reset Is_True_Constant, and desirable for xref purposes.
+
+ Note_Possible_Modification (Lhs);
return;
+ -- If we know the right hand side is non-null, then we convert to the
+ -- target type, since we don't need a run time check in that case.
+
elsif not Can_Never_Be_Null (T2) then
- Rewrite (Rhs,
- Convert_To (T1, Relocate_Node (Rhs)));
+ Rewrite (Rhs, Convert_To (T1, Relocate_Node (Rhs)));
Analyze_And_Resolve (Rhs, T1);
end if;
end if;