aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2018-08-21 14:49:34 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-08-21 14:49:34 +0000
commit0db1c3863d5167dd47e5a0ab4a714ace875a9202 (patch)
treec4a0ebe971f279ef50bb7d01b5146d9d0b097b64 /gcc/ada/gcc-interface
parent5b1c45479aa2fd573063e370005f0c377e8b888e (diff)
downloadgcc-0db1c3863d5167dd47e5a0ab4a714ace875a9202.zip
gcc-0db1c3863d5167dd47e5a0ab4a714ace875a9202.tar.gz
gcc-0db1c3863d5167dd47e5a0ab4a714ace875a9202.tar.bz2
[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. From-SVN: r263734
Diffstat (limited to 'gcc/ada/gcc-interface')
0 files changed, 0 insertions, 0 deletions