diff options
author | Robert Dewar <dewar@adacore.com> | 2015-05-12 12:42:48 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2015-05-12 14:42:48 +0200 |
commit | c944345b5d210e9f003bd1088f0087b9a22068c0 (patch) | |
tree | 7edc43d37d922b72a4c5f190f0b566dfd2efb006 /gcc/ada/sem_intr.adb | |
parent | 52ea13f2c135cdec424dc6a55346ec1250d54d2e (diff) | |
download | gcc-c944345b5d210e9f003bd1088f0087b9a22068c0.zip gcc-c944345b5d210e9f003bd1088f0087b9a22068c0.tar.gz gcc-c944345b5d210e9f003bd1088f0087b9a22068c0.tar.bz2 |
sem_intr.adb: (Check_Shift): Diagnose bad modulus value.
2015-05-12 Robert Dewar <dewar@adacore.com>
* sem_intr.adb: (Check_Shift): Diagnose bad modulus value.
2015-05-12 Robert Dewar <dewar@adacore.com>
* gnat1drv.adb (Adjust_Global_Switches): Default to suppressing
Alignment_Checks on non-strict alignment machine.
* sem_ch13.adb (Validate_Address_Clauses): Don't give
compile-time alignment warnings if run time Alignment_Check
is suppressed.
From-SVN: r223063
Diffstat (limited to 'gcc/ada/sem_intr.adb')
-rw-r--r-- | gcc/ada/sem_intr.adb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/ada/sem_intr.adb b/gcc/ada/sem_intr.adb index f61b47a..79f633a 100644 --- a/gcc/ada/sem_intr.adb +++ b/gcc/ada/sem_intr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-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- -- @@ -430,13 +430,27 @@ package body Sem_Intr is then Errint ("first argument for shift must have size 8, 16, 32 or 64", - Ptyp1, N); + Ptyp1, N); return; elsif Non_Binary_Modulus (Typ1) then Errint ("shifts not allowed for non-binary modular types", Ptyp1, N); + -- For modular type, modulus must be 2**8, 2**16, 2**32, or 2**64. + -- Don't apply to generic types, since we may not have a modulus value. + + elsif Is_Modular_Integer_Type (Typ1) + and then not Is_Generic_Type (Typ1) + and then Modulus (Typ1) /= Uint_2 ** 8 + and then Modulus (Typ1) /= Uint_2 ** 16 + and then Modulus (Typ1) /= Uint_2 ** 32 + and then Modulus (Typ1) /= Uint_2 ** 64 + then + Errint + ("modular type for shift must have modulus of 2'*'*8, " + & "2'*'*16, 2'*'*32, or 2'*'*64", Ptyp1, N); + elsif Etype (Arg1) /= Etype (E) then Errint ("first argument of shift must match return type", Ptyp1, N); |