[Ada] Incorrect accessibility checking on aliased formals
authorJustin Squirek <squirek@adacore.com>
Wed, 8 Jan 2020 03:57:19 +0000 (22:57 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 3 Jun 2020 10:01:38 +0000 (06:01 -0400)
commitda566eeb31056d9f40ab48688dc3fe680535ce80
tree1061a9df6eff0d0cd091dd626c0232c37027a82b
parent79e267f9fb23da4e9553a97dc45ea757545cf521
[Ada] Incorrect accessibility checking on aliased formals

2020-06-03  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* libgnat/a-cborse.adb, libgnat/a-cihase.adb,
libgnat/a-ciorse.adb, libgnat/a-coorse.adb: Modified to use
'Unrestricted_Access in certain cases where static accessibility
errors were triggered.
* exp_ch6.adb (Expand_Simple_Return_Statement): Add generation
of dynamic accessibility checks as determined by
Is_Special_Aliased_Formal_Access.
* sem_attr.adb (Resolve_Attribute): Add call to
Is_Special_Aliased_Formal_Access to avoid performing static
checks where dynamic ones are required.
* sem_ch6.adb (Check_Return_Obj_Accessibility): Handle renamed
objects within component associations requiring special
accessibility checks.
* sem_util.adb, sem_util.ads (Is_Special_Aliased_Formal_Access):
Created to detect the special case where an aliased formal is
being compared against the level of an anonymous access return
object.
(Object_Access_Level): Remove incorrect condition leading to
overly permissive accessibility levels being returned on
explicitly aliased parameters.
gcc/ada/exp_ch6.adb
gcc/ada/libgnat/a-cborse.adb
gcc/ada/libgnat/a-cihase.adb
gcc/ada/libgnat/a-ciorse.adb
gcc/ada/libgnat/a-coorse.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads