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 ABB1B3858423 for ; Sat, 15 Apr 2023 17:39:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ABB1B3858423 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 j5so829704wms.0 for ; Sat, 15 Apr 2023 10:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1681580380; x=1684172380; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=kfqkxnOcv2PfzCgfehlcZXoKmYTdF04sGRr/HTdlIzw=; b=HkXdCmftwPDHaNce+Htpc+dF5B7g+giGTeEesIoTkA7jux40CkQFP1mJ7FScp/9O6x 2SsLxO8ijR0xVMMqrjdUvB6yemj8xvkE0WmQQwhMHGtMknwtkY0tXvN6fQTSpgX/QxFt kvPhfYSMewlSElaeOi46+6gA37ne5khhK+xe6TYFSnFquCQFfJzBte+aTtW4lfq6BaEO ep6KzPrlwMGzhJO3yaueyPSXencpCoKAg6u1brQvWYNkB+/mw9WqZy8benpuCpKnbDm9 +YhRYJvx+nYtK/gz+MLfUqNwXibmB0mHFQb9x0gpkMNtOlOOxN5TJJD4ur/fR53d10q0 AKLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681580380; x=1684172380; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kfqkxnOcv2PfzCgfehlcZXoKmYTdF04sGRr/HTdlIzw=; b=YupuFbd9J+bCXKEhcz1STMLh7Wr3Sb8TZH1kgqawsO1mC+AR68BwsOLxoBgsbi5awN 8gifl6x5bqUjNPORhvSR37p4jFlPmoER1Lrr150QDtjNWSlblXfIvl0LyL52CzjGEv8T J46/UFzVmFyJRN7/wfy4ha9hCDQWUlCRnsb4Djm2vK2zYwXAKAR2jHfGEZM4X/qkPpeT XLBHvNbEu0KZ8Ny1u/YqzLhhn7a1i2M1S+GBbhAQWY1yjkfb6kgCgm8w0qXucc4t4rK6 GTMh0J9HT/RhNGGwLWuhG4JlDWzC3e3KILCdCWwyjaH1BSMwab2CqJ3r2e44P7+LZRft nlgA== X-Gm-Message-State: AAQBX9euBui5sZzofDvoo8pQIJGNyY91yh3j0jJ+18acAMsGdv/TWs3D Px61DfQEa/ty0+Ss62GoAPdfFYGUJS2tzOs9E+KWEw== X-Google-Smtp-Source: AKy350boGQaL7SN71HzaqAjmkyBm5mo7v13jYgH0FLPDCeKTmcCvempx2s6yOqKBahX2g3wUNxS5nQ== X-Received: by 2002:a05:600c:b49:b0:3f1:7123:fd12 with SMTP id k9-20020a05600c0b4900b003f17123fd12mr72404wmr.34.1681580380264; Sat, 15 Apr 2023 10:39:40 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b003ef36ef3833sm11026550wmo.8.2023.04.15.10.39.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 10:39:39 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Re: [Ada] Fix PR bootstrap/109510 Date: Sat, 15 Apr 2023 19:39:38 +0200 Message-ID: <3224588.aeNJFYEL58@fomalhaut> In-Reply-To: <1927733.PYKUYFuaPT@fomalhaut> References: <1927733.PYKUYFuaPT@fomalhaut> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart3230771.44csPzL39Z" Content-Transfer-Encoding: 7Bit X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_NUMSUBJECT,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: This is a multi-part message in MIME format. --nextPart3230771.44csPzL39Z Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" > Tested on Aarch64/Linux by Richard S. (thanks!) and on x86-64/Linux by me, > and applied on the mainline. It turns out that it slightly broke the x86/Linux compiler, which is not yet an acceptable trade-off. Adjusted like this, tested on x86[_64]/Linux, this should not change anything for Aarch64 in particular. PR bootstrap/109510 * gcc-interface/decl.cc (gnat_to_gnu_entity) : Do not reset align to zero in any case. Set TYPE_USER_ALIGN on the type only if it is an aggregate type, or else a type whose default alignment is specifically capped on selected platforms. -- Eric Botcazou --nextPart3230771.44csPzL39Z Content-Disposition: attachment; filename="p.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="p.diff" diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 851a6745f77..20f43de9ea9 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -4371,10 +4371,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) align = validate_alignment (Alignment (gnat_entity), gnat_entity, TYPE_ALIGN (gnu_type)); - /* Treat confirming clauses on scalar types like the default. */ - if (align == TYPE_ALIGN (gnu_type) && !AGGREGATE_TYPE_P (gnu_type)) - align = 0; - /* Warn on suspiciously large alignments. This should catch errors about the (alignment,byte)/(size,bit) discrepancy. */ if (align > BIGGEST_ALIGNMENT && Has_Alignment_Clause (gnat_entity)) @@ -4657,6 +4653,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* If this is not an unconstrained array type, set some flags. */ if (TREE_CODE (gnu_type) != UNCONSTRAINED_ARRAY_TYPE) { + bool align_clause; + /* Record the property that objects of tagged types are guaranteed to be properly aligned. This is necessary because conversions to the class-wide type are translated into conversions to the root type, @@ -4669,8 +4667,20 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) if (is_by_ref && !VOID_TYPE_P (gnu_type)) TYPE_BY_REFERENCE_P (gnu_type) = 1; - /* Record whether an alignment clause was specified. */ - if (align > 0 && Present (Alignment_Clause (gnat_entity))) + /* Record whether an alignment clause was specified. At this point + scalar types with a non-confirming clause have been wrapped into + a record type, so only scalar types with a confirming clause are + left untouched; we do not set the flag on them except if they are + types whose default alignment is specifically capped in order not + to lose the specified alignment. */ + if ((AGGREGATE_TYPE_P (gnu_type) + && Present (Alignment_Clause (gnat_entity))) + || (double_float_alignment > 0 + && is_double_float_or_array (gnat_entity, &align_clause) + && align_clause) + || (double_scalar_alignment > 0 + && is_double_scalar_or_array (gnat_entity, &align_clause) + && align_clause)) TYPE_USER_ALIGN (gnu_type) = 1; /* Record whether a pragma Universal_Aliasing was specified. */ --nextPart3230771.44csPzL39Z--