aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2021-07-08 12:55:38 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-09-21 15:25:01 +0000
commit618fff6043926c95657ae81f6ec93e1e9d3dc1bd (patch)
treeb095c8327bd12f25fb5e7871e43a238826547cea
parent900f9d999cc4870cc3cb70224e9694212385a4d3 (diff)
downloadgcc-618fff6043926c95657ae81f6ec93e1e9d3dc1bd.zip
gcc-618fff6043926c95657ae81f6ec93e1e9d3dc1bd.tar.gz
gcc-618fff6043926c95657ae81f6ec93e1e9d3dc1bd.tar.bz2
[Ada] Fix regression in ACATS bdd2006 and bdd2007
gcc/ada/ * sem_ch13.adb (Stream_Size): Print message about allowed stream sizes even if other error were already found. This avoids falling into the 'else', which prints "Stream_Size cannot be given for...", which is misleading -- the Size COULD be given if it were correct.
-rw-r--r--gcc/ada/sem_ch13.adb17
1 files changed, 11 insertions, 6 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index b6face3..228fd39 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -7824,12 +7824,17 @@ package body Sem_Ch13 is
if Duplicate_Clause then
null;
- elsif Is_Elementary_Type (U_Ent) and then Present (Size) then
- if Size /= System_Storage_Unit
- and then Size /= System_Storage_Unit * 2
- and then Size /= System_Storage_Unit * 3
- and then Size /= System_Storage_Unit * 4
- and then Size /= System_Storage_Unit * 8
+ elsif Is_Elementary_Type (U_Ent) then
+ -- Size will be empty if we already detected an error
+ -- (e.g. Expr is of the wrong type); we might as well
+ -- give the useful hint below even in that case.
+
+ if No (Size) or else
+ (Size /= System_Storage_Unit
+ and then Size /= System_Storage_Unit * 2
+ and then Size /= System_Storage_Unit * 3
+ and then Size /= System_Storage_Unit * 4
+ and then Size /= System_Storage_Unit * 8)
then
Error_Msg_N
("stream size for elementary type must be 8, 16, 24, " &