GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ada

Ada: Fix assertion failure in Make_Class_Precondition_Subps

Resolves an assertion failure in the Ada compiler related to class precondition subprograms.

This commit fixes an assertion failure in the Ada compiler’s contract processing. The Make_Class_Precondition_Subps function was incorrectly called for primitive wrapper subprograms, which are not intended to have class preconditions. The fix modifies the function to accept these wrapper subprograms, thereby preventing the assertion failure and ensuring correct handling of Ada contracts.

In Details

Corrects gcc/ada/contracts.adb:Make_Class_Precondition_Subps to handle wrapper subprograms, specifically primitive wrappers, which were previously causing an assertion failure. The Build_Class_Condition_Subprograms procedure was erroneously passing such wrappers to Make_Class_Precondition_Subps. This change broadens the acceptance criteria within Make_Class_Precondition_Subps to accommodate these wrapper kinds, ensuring that contract compilation proceeds without assertion violations.

For Context
Ada
A high-level, statically typed, imperative, and object-oriented programming language designed for large, long-lived, and error-prone applications.
assertion failure
An error that occurs when a program's internal consistency check (an assertion) fails, indicating a potential bug.
subprogram
In Ada, a procedure or function.
wrapper subprogram
A subprogram that acts as an intermediary, often used to adapt an interface or add behavior around another subprogram.
contracts
In software engineering, specifications of expected behavior, often including preconditions, postconditions, and invariants. Ada supports contracts through features like aspect specifications.
Filed Under: adacompilercontracts