public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Bob Duff <duff@adacore.com>
Subject: [Ada] Avoid gnatbind regression caused by Copy_Bitfield
Date: Wed, 18 Sep 2019 08:41:00 -0000	[thread overview]
Message-ID: <20190918083945.GA145298@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

The recent Copy_Bitfield change caused gnatbind to change elaboration
order, causing different error messages.

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-09-18  Bob Duff  <duff@adacore.com>

gcc/ada/

	* exp_ch5.adb (Expand_Assign_Array_Loop_Or_Bitfield): Move call
	to RTE_Available later, so it doesn't disturb the elab order.
	The RE_Copy_Bitfield entity is defined in package
	System.Bitfields which has a dependency on package
	System.Bitfield_Utils, which has it its spec:

	   pragma Elaborate_Body;

	The query on RTE_Available forces loading and analyzing
	System.Bitfields and all its withed units.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 872 bytes --]

--- gcc/ada/exp_ch5.adb
+++ gcc/ada/exp_ch5.adb
@@ -1475,8 +1475,7 @@ package body Exp_Ch5 is
       --  optimization in that case as well.  We could complicate this code by
       --  actually looking for such volatile and independent components.
 
-      if RTE_Available (RE_Copy_Bitfield)
-        and then Is_Bit_Packed_Array (L_Type)
+      if Is_Bit_Packed_Array (L_Type)
         and then Is_Bit_Packed_Array (R_Type)
         and then not Reverse_Storage_Order (L_Type)
         and then not Reverse_Storage_Order (R_Type)
@@ -1489,6 +1488,7 @@ package body Exp_Ch5 is
         and then not Has_Independent_Components (R_Type)
         and then not L_Prefix_Comp
         and then not R_Prefix_Comp
+        and then RTE_Available (RE_Copy_Bitfield)
       then
          return Expand_Assign_Array_Bitfield
            (N, Larray, Rarray, L_Type, R_Type, Rev);


                 reply	other threads:[~2019-09-18  8:41 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=20190918083945.GA145298@adacore.com \
    --to=derodat@adacore.com \
    --cc=duff@adacore.com \
    --cc=gcc-patches@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).