aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/checks.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-07-16 16:51:47 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2014-07-16 16:51:47 +0200
commit9dc30a5f18d3827d10f118b1758e8453f7aca994 (patch)
treeec2a720219a4bc464450f1ff933fe2c4baf0d68e /gcc/ada/checks.adb
parent2ffcbaa5969ea7f6ae55877df1b859f1369fdc2b (diff)
downloadgcc-9dc30a5f18d3827d10f118b1758e8453f7aca994.zip
gcc-9dc30a5f18d3827d10f118b1758e8453f7aca994.tar.gz
gcc-9dc30a5f18d3827d10f118b1758e8453f7aca994.tar.bz2
[multiple changes]
2014-07-16 Vincent Celier <celier@adacore.com> * gnatls.adb: Get the target parameters only if -nostdinc was not specified. 2014-07-16 Ed Schonberg <schonberg@adacore.com> * checks.adb (Insert_Valid_Check): If the expression is a packed component of a modular type of the right size the data is always valid. This os particularly useful if the component is part of a volatile variable. 2014-07-16 Robert Dewar <dewar@adacore.com> * gnat_rm.texi, sinfo.ads, freeze.adb, exp_aggr.adb: Minor reformatting 2014-07-16 Thomas Quinot <quinot@adacore.com> * exp_ch7.ads: Minor documentation fix. From-SVN: r212663
Diffstat (limited to 'gcc/ada/checks.adb')
-rw-r--r--gcc/ada/checks.adb11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 87777de..ea1f164 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -6444,6 +6444,17 @@ package body Checks is
return;
end if;
+ -- If the expression is a packed component of a modular type of the
+ -- right size, the data is always valid.
+
+ if Nkind (Expr) = N_Selected_Component
+ and then Present (Component_Clause (Entity (Selector_Name (Expr))))
+ and then Is_Modular_Integer_Type (Typ)
+ and then Modulus (Typ) = 2 ** Esize (Entity (Selector_Name (Expr)))
+ then
+ return;
+ end if;
+
-- If we have a checked conversion, then validity check applies to
-- the expression inside the conversion, not the result, since if
-- the expression inside is valid, then so is the conversion result.