Compiler mistakes restriction violation
Supports writing Ada software for Cortex-M3, M4F boards
Status: Alpha
Brought to you by:
simonjwright
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);
This compiler problem is OBE (fixed in GNAT GPL 2015, FSF GCC 5.1.0).