diff options
author | Ed Schonberg <schonberg@adacore.com> | 2015-10-26 11:21:21 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2015-10-26 12:21:21 +0100 |
commit | 1f145d79e95b1b7d90c95b7615993bc9ff767931 (patch) | |
tree | 8ff110df2b0429c68b2f3fda13597ed1934d7664 /gcc/ada/sem_case.adb | |
parent | 21d7ef70aae92c62a6c39233e899b9ed70ace566 (diff) | |
download | gcc-1f145d79e95b1b7d90c95b7615993bc9ff767931.zip gcc-1f145d79e95b1b7d90c95b7615993bc9ff767931.tar.gz gcc-1f145d79e95b1b7d90c95b7615993bc9ff767931.tar.bz2 |
sem_case.adb (Check_Choice_Set): Choose initial choice range below low bound of type...
2015-10-26 Ed Schonberg <schonberg@adacore.com>
* sem_case.adb (Check_Choice_Set): Choose initial choice range
below low bound of type, to prevent spurious errors on case
statements whose expressions have an integer subtype with a
static predicate.
* sem_util.ads: Fix typo.
From-SVN: r229332
Diffstat (limited to 'gcc/ada/sem_case.adb')
-rw-r--r-- | gcc/ada/sem_case.adb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb index 201855b..a23358a 100644 --- a/gcc/ada/sem_case.adb +++ b/gcc/ada/sem_case.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -766,8 +766,14 @@ package body Sem_Case is if Has_Predicate then Pred := First (Static_Discrete_Predicate (Bounds_Type)); - Prev_Lo := Uint_Minus_1; - Prev_Hi := Uint_Minus_1; + + -- Make initial value smaller than 'First of type, so that first + -- range comparison succeeds. This applies both to integer types + -- and to enumeration types. + + Prev_Lo := Expr_Value (Type_Low_Bound (Bounds_Type)) - 1; + Prev_Hi := Prev_Lo; + Error := False; for Index in 1 .. Num_Choices loop |