[Ada] Wrong code with -gnatVa on lock-free protected objects
authorEd Schonberg <schonberg@adacore.com>
Mon, 1 Jul 2019 13:36:56 +0000 (13:36 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 1 Jul 2019 13:36:56 +0000 (13:36 +0000)
commit90fd73bbeaad8438a3251e061f8f6525691f3c30
tree2f4f105ad34d7cfe70216ad8cd9cc29634a7dbef
parent69b5279e977593d656906288316ee03a8bf79c6a
[Ada] Wrong code with -gnatVa on lock-free protected objects

This patch fixes the handling of validity checks on protected objects
that use the Lock-Free implementation when validity checks are enabled,
previous to this patch the compiler would report improperly that a
condition in a protected operation was always True (when comoipled with
-gnatwa) and would generate incorrect code fhat operation.

2019-07-01  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* checks.adb (Insert_Valid_Check): Do not apply validity check
to variable declared within a protected object that uses the
Lock_Free implementation, to prevent unwarranted constant
folding, because entities within such an object msut be treated
as volatile.

gcc/testsuite/

* gnat.dg/prot7.adb, gnat.dg/prot7.ads: New testcase.

From-SVN: r272873
gcc/ada/ChangeLog
gcc/ada/checks.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/prot7.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/prot7.ads [new file with mode: 0644]