From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id C484B3857714; Fri, 15 Sep 2023 13:04:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C484B3857714 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694783094; bh=XLOExZRH8Vc6E3PM+WjH9K+RB4f2R4tfXhGHJPs59qg=; h=From:To:Subject:Date:From; b=HtRSrqtPeS2gg7BIixWvaDcPXBjaRuRguXvGv2pBnjnNvN4beF9cAGl1QCdHPp/RU DKLrAL5uu0fzIRdVyOe5Tb3q4XFkQB9XhgA6+y+FVQ3qv/Yg1hvDC8FPmVyHUhDaIP KrSjs0hhgL7C+1dfj0gc1Bw34UwBaDqJ5V2drNLY= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-4028] ada: Fix internal error on misaligned component with variable nominal size X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/master X-Git-Oldrev: ab246c16eeb82a9ba21be464eacc7c2aaca5f60c X-Git-Newrev: 140e20f69754bd04b7ee47518d065c1338780c36 Message-Id: <20230915130454.C484B3857714@sourceware.org> Date: Fri, 15 Sep 2023 13:04:54 +0000 (GMT) List-Id: https://gcc.gnu.org/g:140e20f69754bd04b7ee47518d065c1338780c36 commit r14-4028-g140e20f69754bd04b7ee47518d065c1338780c36 Author: Eric Botcazou Date: Thu Sep 7 10:53:39 2023 +0200 ada: Fix internal error on misaligned component with variable nominal size The back-end cannot handle this kind of components even when they are small. gcc/ada/ * exp_util.adb (Component_May_Be_Bit_Aligned): Do not return false for a small component of a record type with a variant part. Diff: --- gcc/ada/exp_util.adb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index b2542d4ae59..2e6a1cf892e 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -4989,12 +4989,15 @@ package body Exp_Util is return False; -- If we know that we have a small (at most the maximum integer size) - -- record or bit-packed array, then everything is fine, since the back - -- end can handle these cases correctly, except if a slice is involved. + -- bit-packed array or record without variant part, then everything is + -- fine, since the back end can handle these cases correctly, except if + -- a slice is involved. elsif Known_Esize (Comp) and then Esize (Comp) <= System_Max_Integer_Size - and then (Is_Record_Type (UT) or else Is_Bit_Packed_Array (UT)) + and then (Is_Bit_Packed_Array (UT) + or else (Is_Record_Type (UT) + and then not Has_Variant_Part (UT))) and then not For_Slice then return False;