From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id DA6193857C6C; Tue, 21 Sep 2021 15:27:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA6193857C6C MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-3749] [Ada] Fix regression in ACATS bdd2006 and bdd2007 X-Act-Checkin: gcc X-Git-Author: Bob Duff X-Git-Refname: refs/heads/master X-Git-Oldrev: 900f9d999cc4870cc3cb70224e9694212385a4d3 X-Git-Newrev: 618fff6043926c95657ae81f6ec93e1e9d3dc1bd Message-Id: <20210921152740.DA6193857C6C@sourceware.org> Date: Tue, 21 Sep 2021 15:27:40 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 15:27:41 -0000 https://gcc.gnu.org/g:618fff6043926c95657ae81f6ec93e1e9d3dc1bd commit r12-3749-g618fff6043926c95657ae81f6ec93e1e9d3dc1bd Author: Bob Duff Date: Thu Jul 8 12:55:38 2021 -0400 [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. Diff: --- gcc/ada/sem_ch13.adb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index b6face3136d..228fd399983 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, " &