https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66205

            Bug ID: 66205
           Summary: gnatbind generates invalid code when finalization is
                    enabled in restricted runtime
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon at pushface dot org
  Target Milestone: ---

Created attachment 35567
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35567&action=edit
Patch to gcc/ada/bindgen.adb

This is on 4.9.1 compiled for arm-eabi on Mac OS X Mavericks (Darwin 13).
Please note that the same problem occurs with 5.1.0.

package System has

pragma Profile (Ravenscar);
pragma Restrictions (No_Enumeration_Maps);
pragma Restrictions (No_Exception_Propagation);
pragma Restrictions (No_Recursion);

and the result of a gprbuild is

gprbuild -p -P testbed
gprbind testbed.bexch
arm-eabi-gnatbind testbed.ali
arm-eabi-gcc -c b__testbed.adb
b__testbed.adb:31:14: "Is_Elaborated" is undefined (more references follow)
gprbind: compilation of binder generated file failed
gprbuild: unable to bind testbed.adb

which happens because bindgen.adb has at :2497

         if not Suppress_Standard_Library_On_Target then
            WBI ("   Is_Elaborated : Boolean := False;");
         end if;

but at :408 in the generation of adafinal

      if not CodePeer_Mode then
         WBI ("      if not Is_Elaborated then");
         WBI ("         return;");
         WBI ("      end if;");
         WBI ("      Is_Elaborated := False;");
      end if;

I’ve worked out a patch for this, but I’m confused about when to use
Suppress_Standard_Library_On_Target vs Configurable_Run_Time_On_Target vs
Configurable_Run_Time_Mode to determine that adafinal will never actually be
called & hence needn’t do anything.

Not sure whether __gnat_initialize, __gnat_finalize are expected (they aren’t
in the AdaCore arm-eabi libraries), so I’ve suppressed them too.

Reply via email to