aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2019-08-20 09:48:57 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-20 09:48:57 +0000
commitafdc759841f8f4f464f3d5a2ba8e05e9a8e41d72 (patch)
treed6b32bef1abb656d0d22855f4f90e9ff53a386f3 /gcc/ada
parent6cd8f5b09415ec799f797e5b521afd18552cd747 (diff)
downloadgcc-afdc759841f8f4f464f3d5a2ba8e05e9a8e41d72.zip
gcc-afdc759841f8f4f464f3d5a2ba8e05e9a8e41d72.tar.gz
gcc-afdc759841f8f4f464f3d5a2ba8e05e9a8e41d72.tar.bz2
[Ada] Object_Size clause specifying 0 bits is illegal
The patch gives an error message on "for T'Object_Size use 0;". 2019-08-20 Bob Duff <duff@adacore.com> gcc/ada/ * sem_ch13.adb (Object_Size): Give an error for zero. It really rubs me the wrong way that we don't honor "for T'Object_Size use 0;", but it's not important enough to fix. In any case, if we're not going to obey the clause, we should give an error. gcc/testsuite/ * gnat.dg/object_size1.adb: New testcase. From-SVN: r274722
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/sem_ch13.adb3
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 558d5e0..61befab 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,12 @@
2019-08-20 Bob Duff <duff@adacore.com>
+ * sem_ch13.adb (Object_Size): Give an error for zero. It really
+ rubs me the wrong way that we don't honor "for T'Object_Size use
+ 0;", but it's not important enough to fix. In any case, if we're
+ not going to obey the clause, we should give an error.
+
+2019-08-20 Bob Duff <duff@adacore.com>
+
* errout.adb (Error_Msg_Internal): Set Warn_Err in case of
Is_Style_Msg.
* erroutc.adb (Output_Msg_Text): Do Warnings_Treated_As_Errors
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 4a07478..dec542b 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -5812,6 +5812,9 @@ package body Sem_Ch13 is
if ASIS_Mode then
null;
+ elsif Size <= 0 then
+ Error_Msg_N ("Object_Size must be positive", Expr);
+
elsif Is_Scalar_Type (U_Ent) then
if Size /= 8 and then Size /= 16 and then Size /= 32
and then UI_Mod (Size, 64) /= 0