Ada: Fix assertion failure in extension aggregate allocator with task
Fixed an assertion failure when initializing Ada extension aggregates that contain tasks.
This commit addresses an assertion failure in the Ada compiler related to the initialization of extension aggregates containing task components. The failure occurred because a necessary pointer to the type was not being passed correctly during the construction of the aggregate’s code. The changes ensure that the correct type information is propagated through the expansion and allocation procedures, resolving the assertion and improving the compiler’s robustness for complex Ada types.
In Details
The Ada frontend fix in exp_aggr.adb resolves an assertion failure in Late_Expansion when processing an extension aggregate used in an allocator, where an ancestor type contains a task component. The issue was that the _Master formal parameter of the ancestor's initialization procedure was not being correctly passed. The fix introduces a Ptr_Typ formal parameter to Late_Expansion and Build_Record_Aggr_Code, and passes this parameter to Build_Initialization_Call, ensuring that the correct type information is available for tasks within the aggregate.
- Ada
- A high-level, statically and strongly typed, imperative programming language, used extensively in high-integrity and safety-critical systems.
- extension aggregate
- In Ada, an aggregate used to create a value of an extension type (a type that inherits from another type). It can initialize components from an ancestor aggregate.
- task
- In Ada, a built-in concurrency mechanism that allows for parallel execution of code, similar to threads in other languages.
- allocator
- A function or mechanism used to dynamically allocate memory for objects, typically in languages with garbage collection or manual memory management.