Ada: Fix validity check for function calls with 'Value attribute.
Fixes a bogus error in Ada's validity checking for function calls involving 'Value and -gnatVa.
This change corrects an error in the Ada compiler’s validity checking mechanism when the ‘-gnatVa’ flag is used. Specifically, it addresses an issue where a bogus error was reported for function calls that return a value and also involve an ‘In Out’ or ‘Out’ parameter. The fix ensures the copy-out statement for these parameters is inserted correctly.
In Details
The Ada front-end's expression elaboration routine Insert_Post_Call_Actions in exp_ch6.adb has been updated. It now correctly handles attribute references (like Value) when they appear as the parent node in the Abstract Syntax Tree (AST) during the generation of validity checks mandated by the -gnatVa compiler switch. This is crucial for Ada 2012 and later features involving 'In Out' or 'Out' parameters, preventing incorrect copy-out statement insertion.
- Ada
- A structured, statically typed, and imperative programming language, known for its use in high-integrity systems.
- -gnatVa
- An Ada compiler flag that enables validity checking for function calls, ensuring that function results and out-parameters meet certain criteria.
- Value attribute
- In Ada, the 'Value attribute applied to an access type denotes the object designated by the access value.
- In Out parameter
- An Ada parameter mode that allows a parameter to be passed both into and out of a subprogram.
- Out parameter
- An Ada parameter mode that allows a parameter to be passed out of a subprogram.
- Abstract Syntax Tree (AST)
- A tree representation of the abstract syntactic structure of source code, used internally by compilers.