Menu

#11 Compiler mistakes restriction violation

wont-fix
None
2015-08-10
2015-02-12
No

A package containing an instantiation of Ada.Containers.Bounded_Vectors couldn’t be linked because the compiler (GCC 4.9.1 and GNAT GPL 2014) had mistakenly decided that it violated the restriction No_Implicit_Heap_Allocations (which is part of the Ravenscar profile).

GCC 5.0.0 doesn’t have this error.

A workround (which allowed the package which revealed the problem to be built) was to explicitly state the restriction in the body:

pragma Restrictions (No_Implicit_Heap_Allocations);

with Ada.Containers.Bounded_Vectors;

package body Containing is

   subtype Index is Natural range 0 .. 19;
   subtype Line is String (1 .. 20);

   package Line_Vectors
     is new Ada.Containers.Bounded_Vectors (Index_Type   => Index,
                                            Element_Type => Line);

Related

Wiki: CompilerIssues

Discussion

  • Simon Wright

    Simon Wright - 2015-02-14
     
  • Simon Wright

    Simon Wright - 2015-08-10
    • status: open --> wont-fix
     
  • Simon Wright

    Simon Wright - 2015-08-10

    This compiler problem is OBE (fixed in GNAT GPL 2015, FSF GCC 5.1.0).

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.