public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-3749] [Ada] Fix regression in ACATS bdd2006 and bdd2007
Date: Tue, 21 Sep 2021 15:27:40 +0000 (GMT)	[thread overview]
Message-ID: <20210921152740.DA6193857C6C@sourceware.org> (raw)

https://gcc.gnu.org/g:618fff6043926c95657ae81f6ec93e1e9d3dc1bd

commit r12-3749-g618fff6043926c95657ae81f6ec93e1e9d3dc1bd
Author: Bob Duff <duff@adacore.com>
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, " &


                 reply	other threads:[~2021-09-21 15:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210921152740.DA6193857C6C@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).