aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/checks.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-11-18 11:53:39 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2015-11-18 11:53:39 +0100
commitfdc54be6a0216ac2b4c585824539712d162b8e26 (patch)
tree34ba584a7a250519b5af1e0804a532ecbb456e43 /gcc/ada/checks.adb
parent3f8d242bd3ad399b3ce685c154780d2da9dd51b7 (diff)
downloadgcc-fdc54be6a0216ac2b4c585824539712d162b8e26.zip
gcc-fdc54be6a0216ac2b4c585824539712d162b8e26.tar.gz
gcc-fdc54be6a0216ac2b4c585824539712d162b8e26.tar.bz2
[multiple changes]
2015-11-18 Hristian Kirtchev <kirtchev@adacore.com> * atree.adb (Elist11): New routine. (Set_Elist11): New routine. * atree.ads (Elist11): New routine. (Set_Elist11): New routine. * atree.h: Define Elist11. * contracts.adb (Analyze_Object_Contract): Verify the legality of all references to a variable given that the variable is a constituent of a single protected/task type. * einfo.adb: Part_Of_References now utilizes Elist11. (Part_Of_References): New routine. (Set_Part_Of_References): New routine. (Write_Field11_Name): Add output for Part_Of_References. * einfo.ads New attribute Part_Of_References along with usage in entities. (Part_Of_References): New routine along with pragma Inline. (Set_Part_Of_References): New routine along with pragma Inline. * sem_prag.adb (Analyze_Constituent): Record a possible reference to a concurrent constituent. (Analyze_Global_Item): Record a possible reference to a concurrent constituent. (Analyze_Input_Output): Record a possible reference to a concurrent constituent. * sem_res.adb (Resolve_Entity_Name): Record a possible reference to a concurrent constituent. * sem_util.adb (Check_Part_Of_Reference): New routine. (Record_Possible_Part_Of_Reference): New routine. * sem_util.ads (Check_Part_Of_Reference): New routine. (Record_Possible_Part_Of_Reference): New routine. 2015-11-18 Ed Schonberg <schonberg@adacore.com> * checks.adb (Apply_Arithmetic_Overflow_Minimized_Eliminated): An if_expression is the proper place to apply the overflow minimization procedure if its context is not an enclosing arithmetic expression. From-SVN: r230540
Diffstat (limited to 'gcc/ada/checks.adb')
-rw-r--r--gcc/ada/checks.adb15
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 64dcf57..07a9dac 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -1208,7 +1208,18 @@ package body Checks is
or else (Nkind (P) = N_Range
and then Nkind (Parent (P)) in N_Membership_Test)
then
- return;
+ -- If_Expressions and Case_Expressions are treated as arithmetic
+ -- ops, but if they appear in an assignment or similar contexts
+ -- there is no overflow check that starts from that parent node,
+ -- so apply check now.
+
+ if Nkind_In (P, N_If_Expression, N_Case_Expression)
+ and then not Is_Signed_Integer_Arithmetic_Op (Parent (P))
+ then
+ null;
+ else
+ return;
+ end if;
end if;
-- Otherwise, we have a top level arithmetic operation node, and this
@@ -1302,7 +1313,7 @@ package body Checks is
Analyze_And_Resolve (Op);
end;
- -- Here we know the result is Long_Long_Integer'Base, of that it has
+ -- Here we know the result is Long_Long_Integer'Base, or that it has
-- been rewritten because the parent operation is a conversion. See
-- Apply_Arithmetic_Overflow_Strict.Conversion_Optimization.