From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 437C63858C2B for ; Fri, 15 Sep 2023 14:21:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 437C63858C2B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-403004a96eeso23826065e9.3 for ; Fri, 15 Sep 2023 07:21:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1694787659; x=1695392459; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=KwBm4HKocIRXeEAj/DFpsY5c9Yjf/GTsmpgjVbKnshc=; b=azZijwTAvpctR+l6NOCDWt+vtFq24/6IxdbIh6ARrNZFdUNP8p9DCGpwHkdscVHEIY YNkfp+SRbx+czOu6rB0dNRFuSQv9FjODLbuzsv1K8DfIA8z1/MLcxlkE1mgD/cLJSX7C LmXuG7kDb/ObdmXcwTVIMwo3Ryx4dBkfRRaphh2ZHKIN8FOgHIHJzuNsSewq530M43Ct oZMX/rR9P6pI0Gqoaiwd4bWv/m3s4V6thT/4vBX0OWpHOFZDxQoQi3w3vyLZGn7TAz87 sXN/9qXlCtuI4rMt17IyhzzmahEa3A+vojzrcXAzWKka4OUR6WGSCuzKQSAYLTZ0wpmX hiVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694787659; x=1695392459; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KwBm4HKocIRXeEAj/DFpsY5c9Yjf/GTsmpgjVbKnshc=; b=L7mXg9K3a7RHwANZbFot6s2nXdzdTbIcTVjluLxKOt3n5hsMw7b2JY/1+BHwnhSK/S ca8ZB/7dvR3ws8lQCpVV/RDKTHmYMb2C/yS7i+BrgiFe5AXQopscQFuT4g6womPdYpHo Q6D2XibnJOSYu+IBU3yWuI+vgR2L3gzsCb6YtwXNws4B7U6TvIq/SGSpHVkZfpF9+tM9 779KtQFsFdzAiohz0MmfQGI4qS2aejOSNXJG398GMz1ZoYbcd0o0MAOBkz7RDfAM3ngn ktJl2r3LJ7fhdSZIrjN8EDgm3uP9p5ZBjdpPcdu2ZXtcrnqkUEfa9xNwQKp35HWTr9IC nmUg== X-Gm-Message-State: AOJu0YzVeOC8tuBcbfp5p2dRn1+4ExP7NWx/HtjQAsfXBk/WgIYmdcBp fwmNfOy7iDMFlqe1Ep0Y9jMCkb+0g6NWI5GoKdltbg== X-Google-Smtp-Source: AGHT+IG0OtEWMsQlzXEpeAS3cahq/A7ByqOJHuXZ7bYwOX9GaWOYf38Ikpi8D7CufxMl2gGEai659g== X-Received: by 2002:a05:600c:2614:b0:402:f517:9c07 with SMTP id h20-20020a05600c261400b00402f5179c07mr1694293wma.0.1694787659550; Fri, 15 Sep 2023 07:20:59 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:a63c:a2c3:ab34:f429]) by smtp.gmail.com with ESMTPSA id k11-20020a7bc40b000000b003fefca26c72sm4786848wmi.23.2023.09.15.07.20.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 07:20:59 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix internal error on misaligned component with variable nominal size Date: Fri, 15 Sep 2023 16:20:58 +0200 Message-Id: <20230915142058.2100998-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.7 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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Eric Botcazou 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. Tested on x86_64-pc-linux-gnu, committed on master. --- 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; -- 2.40.0