summaryrefslogtreecommitdiff
path: root/gcc/ada/checks.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-19 11:51:22 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-19 11:51:22 +0000
commitc59f2b2d5b2d7d2a2a7fa045cb14ac364e770794 (patch)
tree27e5a6435029e91ddba30a57d86b60a06a5b3912 /gcc/ada/checks.adb
parentb2f0bdaaaf0f76890b245c12334254e84a20acce (diff)
downloadgcc-c59f2b2d5b2d7d2a2a7fa045cb14ac364e770794.tar.gz
2017-01-19 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.ads, sem_ch4.adb (Try_Object_Operation): Make subprogram public, for use elsewhere. * sem_ch6.adb (Analyze_Procedure_Call): In SPARK_Mode and within an Inlined_body, recognize a call that uses object notation and has not been rewritten as a regular call because regular expansion has not taken place. 2017-01-19 Bob Duff <duff@adacore.com> * checks.adb (Apply_Type_Conversion_Checks): Disable small optimization in case of generic formal discrete types, because it causes crashes in the compiler when built with assertions on. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244620 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/checks.adb')
-rw-r--r--gcc/ada/checks.adb11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 80b4b4b782f..1e2231b3615 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -3391,14 +3391,17 @@ package body Checks is
and then not Float_To_Int
then
-- A small optimization: the attribute 'Pos applied to an
- -- enumeration type has a known range, even though its type
- -- is Universal_Integer. So in numeric conversions it is
- -- usually within range of the target integer type. Use the
- -- static bounds of the base types to check.
+ -- enumeration type has a known range, even though its type is
+ -- Universal_Integer. So in numeric conversions it is usually
+ -- within range of the target integer type. Use the static
+ -- bounds of the base types to check. Disable this optimization
+ -- in case of a generic formal discrete type, because we don't
+ -- necessarily know the upper bound yet.
if Nkind (Expr) = N_Attribute_Reference
and then Attribute_Name (Expr) = Name_Pos
and then Is_Enumeration_Type (Etype (Prefix (Expr)))
+ and then not Is_Generic_Type (Etype (Prefix (Expr)))
and then Is_Integer_Type (Target_Type)
then
declare