aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/bindo-diagnostics.ads
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2019-07-05 07:02:03 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-07-05 07:02:03 +0000
commitdb6261488e4e53e4ac09ec9db50ea2e4a1859377 (patch)
treea986027d4dac11bec4c8e61a041e512a5d4d41aa /gcc/ada/bindo-diagnostics.ads
parent85ee7b4903e320b8f22ac0350afcd07263d2a5d6 (diff)
downloadgcc-db6261488e4e53e4ac09ec9db50ea2e4a1859377.zip
gcc-db6261488e4e53e4ac09ec9db50ea2e4a1859377.tar.gz
gcc-db6261488e4e53e4ac09ec9db50ea2e4a1859377.tar.bz2
[Ada] Compiler abort on a dynamic predicate used in a precondition
This patch suppresses the generation of a predicate check when the expression is a formal IN parameter of a subprogram S. If the check is being applied to the actual in a call, the call is either in the body of S, or in an aspect specfication for S, e.g. a precondition, In both cases the check is redundant bevause it will be applied on any call to S. In the second case the expansion of the predicate check may lead to out-of-scope references the the formal. 2019-07-05 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * checks.adb (Apply_Predicate_Check): Except within the subprogram body that defines the formal, do not apply predicate check on a formal IN parameter: such a check is redundant and its expansion can lead to out-of-scope references when it is originates in a function call in a precondition, gcc/testsuite/ * gnat.dg/predicate7.adb, gnat.dg/predicate7.ads, gnat.dg/predicate7_pkg.ads: New testcase. From-SVN: r273106
Diffstat (limited to 'gcc/ada/bindo-diagnostics.ads')
0 files changed, 0 insertions, 0 deletions