WEDNESDAY, SEPTEMBER 23, 2026
ada
Ada: Correctly handle ill-formed quantified expressions in pragmas
Fixes Program_Error exceptions raised by malformed quantified expressions in Ada pragmas like Assert and Check.
This change resolves an issue where Ada’s compiler raised a Program_Error exception when encountering ill-formed quantified expressions, particularly within pragmas such as Assert, Check, and Loop_Invariant. The fix involves removing unused code related to ‘Old attribute renaming and introducing a new procedure to detect and report these malformed expressions.
In Details
Improves error handling in sem_res.adb and sem_prag.adb for malformed quantified expressions used in pragmas, by removing dead code in Get_Object_Name and adding Malformed_Quantified_Expression checks.
For Context
- quantified expression
- An Ada expression that involves universal quantification (e.g., 'for all X such that P(X) is true') or existential quantification (e.g., 'there exists X such that P(X) is true').
- pragma
- Compiler directives in Ada that provide information to the compiler, such as Assert, Check, or Loop_Invariant.
- Program_Error
- An Ada runtime exception that typically indicates a violation of language constraints or an erroneous program state.