r263734 - in /trunk/gcc: ada/ChangeLog ada/cont...
pmderodat@gcc.gnu.org
pmderodat@gcc.gnu.org
Tue Aug 21 14:49:00 GMT 2018
Author: pmderodat
Date: Tue Aug 21 14:49:34 2018
New Revision: 263734
URL: https://gcc.gnu.org/viewcvs?rev=263734&root=gcc&view=rev
Log:
[Ada] Spurious crash on expression function as completion with contracts
This patch fixes a compiler abort on an expression function that is a
completion of a subprogram with preconditions. The problem is caused by
the presence of types in the precondition that are not frozen when the
subprogram body constructed for the expression function receives the
code that enforces the precondition. These types must be frozen before
the contract is expanded, so the freeze nodes for these types appear in
the proper scope. This is analogous to what is done with type references
that appear in the original expression of the expression function.
2018-08-21 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch6.adb: Remove Freeze_Expr_Types.
* freeze.ads, freeze.adb (Freeze_Expr_Types): Moved from
sem_ch6.adb, and extended to handle other expressions that may
contain unfrozen types that must be frozen in their proper
scopes.
* contracts.adb (Analyze_Entry_Or_Subprogram_Contract): If the
contract is for the generated body of an expression function
that is a completion, traverse the expressions for pre- and
postconditions to freeze all types before adding the contract
code within the subprogram body.
gcc/testsuite/
* gnat.dg/expr_func6.adb, gnat.dg/expr_func6.ads: New testcase.
Added:
trunk/gcc/testsuite/gnat.dg/expr_func6.adb
trunk/gcc/testsuite/gnat.dg/expr_func6.ads
Modified:
trunk/gcc/ada/ChangeLog
trunk/gcc/ada/contracts.adb
trunk/gcc/ada/freeze.adb
trunk/gcc/ada/freeze.ads
trunk/gcc/ada/sem_ch6.adb
trunk/gcc/testsuite/ChangeLog
More information about the Gcc-cvs
mailing list