This is the mail archive of the gcc@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 question about PR 18434


Rainer tracing seems to show that strange thing happen to
Osint.Running_Program during elaboration of 4.0.x. We have:

package body Osint is

   Running_Program : Program_Type := Unspecified;
...
   procedure Set_Program (P : Program_Type) is
   begin
...
      Running_Program := P;
   end Set_Program;
...
package body Osint.M is
...
begin
   Set_Program (Make);
end Osint.M;

However I see no reason why Osint body elaboration must be done
before Osint.M body elaboration, it seems to me that the
binder could perfectly choose to elaborate Osint.M body
before Osint body, and this would leave Running_Program
with the "wrong" value Rainer observes when gnatmake is running.

If I'm guessing correctly there are two solutions:

1/ Remove the default initialization in ada/osint.adb
-   Running_Program : Program_Type := Unspecified;
+   pragma Warnings (Off);
+   Running_Program : Program_Type;
+   pragma Warnings (On);

This is not a long term solution, but local and should fix the problem
if my hypothesis is correct, Rainer could you try this one?

2/ Use elaboration pragma, like may be a pragma Elaborate_Body
in ada/osint.ads but this requires a more global knowledge of
what happens during compiler tools elaboration.

Arnaud, Robert?

Thanks in advance,

Laurent



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