From patchwork Wed Sep 22 15:15:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1531284 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=nVMAX8Ec; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4HF24d0W2Rz9sCD for ; Thu, 23 Sep 2021 01:18:40 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 93C293858433 for ; Wed, 22 Sep 2021 15:18:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93C293858433 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1632323918; bh=0SvC4XOtyKc+4lJRFx4w+3rP0vba8aDiDcx2kMIooi0=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=nVMAX8EcJQGPj927ryTYChTWvOjuV/HLE3U4aGKpbiLjw9z2f+69aEfPvH3vn2OxB j5RL7K6qzOCnRgpOPjWv/0J7eXZXiEHSn942e6yHtD5+27aCAV2Wb1H+2hERHds/B4 PWMj6OXGQXaUKQk7nr0xyExmZX4uTuLzkC8yD/Xo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 423273858406 for ; Wed, 22 Sep 2021 15:15:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 423273858406 Received: by mail-wr1-x430.google.com with SMTP id w29so7845435wra.8 for ; Wed, 22 Sep 2021 08:15:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=0SvC4XOtyKc+4lJRFx4w+3rP0vba8aDiDcx2kMIooi0=; b=ed34N83RAuxYMxF8UAeuU3KwS6+vbVANFeVterqmJ+r6qdeA253MYD7Lbzo+lJtLOO aItxfdud8hZ8WSD+XvRqxHn4ngMINb9A44HM0cjfG9KrHRKsSwnScPKOvsPTld8CyWQI 3N8v1ElY5nIEqOu1wYUJHnsjMDr3ia8roOaBRBrxyppZ0rOdgZR0lJVjMCXqOm+1tUAP Ozm8YgRFl+8WF8am7SAMTxcMSRj5b8m6cCRbDfUwlAV0U5seH3IxFOPAFGYPbq3aHecI WgEOual11XnOvFuBByHl3R7TFXFEZXtV3BsOZlSyQDdug8wFbwnNG7ecLGFDXgnmDAb1 n0vw== X-Gm-Message-State: AOAM533+C+CH+5o9eSGAkiLtDEQ8munzE2cqDvPMgSHyFeKUXLCA7/NH k9XokGKG1DS16iNaYWAMHDfwvFg17RsOAg== X-Google-Smtp-Source: ABdhPJwXn+y0NEdfHktTBMb1BMJ6XxfVMXtxCpHQNxd3JpA7sJMlgSbNKRMdfdmiuVM5EXJOFVqiPg== X-Received: by 2002:a5d:510b:: with SMTP id s11mr78964wrt.79.1632323731229; Wed, 22 Sep 2021 08:15:31 -0700 (PDT) Received: from adacore.com ([2a02:2ab8:224:2ce:72b5:e8ff:feef:ee60]) by smtp.gmail.com with ESMTPSA id o13sm2946140wri.53.2021.09.22.08.15.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Sep 2021 08:15:30 -0700 (PDT) Date: Wed, 22 Sep 2021 15:15:30 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix imprecise wording for error on scalar storage order Message-ID: <20210922151530.GA1907532@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Eric Botcazou Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" The current error message does not distinguish the component clause case from the packed case, which can be confusing in the latter case. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * freeze.adb (Check_Component_Storage_Order): Give a specific error message for non-byte-aligned component in the packed case. Replace "composite" with "record" in both cases. diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -1352,9 +1352,15 @@ package body Freeze is elsif Is_Record_Type (Encl_Base) and then not Comp_Byte_Aligned then - Error_Msg_N - ("type of non-byte-aligned component must have same scalar " - & "storage order as enclosing composite", Err_Node); + if Present (Component_Clause (Comp)) then + Error_Msg_N + ("type of non-byte-aligned component must have same scalar" + & " storage order as enclosing record", Err_Node); + else + Error_Msg_N + ("type of packed component must have same scalar" + & " storage order as enclosing record", Err_Node); + end if; -- Warn if specified only for the outer composite