This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Always prefer Pure/Preelab units in binder elab order


This patch changes the preference order in choosing binder units
to always prefer Pure/Preelab units over those with neither pragma,
and this is true even if -p is specified. Previously -p could cause
preelaborated units to be elaborated too late. It's complex to
generate an example where this causes actual failure (but it can
happen, and a giant program did fail). But here is a simple test:

package elaboa1 is
   procedure q;
end;

package body elaboa1 is
   procedure q is begin null; end;
end;

package elabop1 is
   pragma Preelaborate;
   procedure p;
end elabop1;

package body elabop1 is
   procedure p is begin null; end;
end elabop1;

with elabop1;
with elaboa1;
procedure elabm is begin null; end;

If this is compiled with binder option -l -p, the last lines of the
output from the binder are:

   elabop1 (spec)
   elabop1 (body)
   elaboa1 (spec)
   elabm (body)
   elaboa1 (body)

And as can be seen here, the preelaborated units (elabop1) come
first, even with pessimistic ordering being specified.

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

2010-06-23  Robert Dewar  <dewar@adacore.com>

	* binde.adb (Better_Choice): Always prefer Pure/Preelab.
	(Worse_Choice): Always prefer Pure/Preelab.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]