diff options
author | Gary Dismukes <dismukes@adacore.com> | 2019-08-14 09:50:46 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-08-14 09:50:46 +0000 |
commit | 27de857e21ff577d5b478f3c98e4f3a8ca3b51b3 (patch) | |
tree | c163a22dde0f76585b0540f4e0a30a9c9d966784 /gcc/ada/sem_ch4.adb | |
parent | bc1f44ef8f87228591b7ecd74dac324812c0ff47 (diff) | |
download | gcc-27de857e21ff577d5b478f3c98e4f3a8ca3b51b3.zip gcc-27de857e21ff577d5b478f3c98e4f3a8ca3b51b3.tar.gz gcc-27de857e21ff577d5b478f3c98e4f3a8ca3b51b3.tar.bz2 |
[Ada] Illegal selection of first object in a task type's body not detected
The compiler was improperly allowing selection of an object declared
within a task body when the prefix was of the task type, specifically in
the case where the object was the very first declared in the body
(selections of later body declarations were being flagged). The flag
Is_Private_Op was only set at the point of the first "private"
declaration of the type in cases where the first declaration's name
didn't match the selector.
2019-08-14 Gary Dismukes <dismukes@adacore.com>
gcc/ada/
* sem_ch4.adb (Analyze_Selected_Component): In the case where
the prefix is of a concurrent type, and the selected entity
matching the selector is the first private declaration of the
type (such as the first local variable in a task's body), set
Is_Private_Op.
gcc/testsuite/
* gnat.dg/task5.adb: New testcase.
From-SVN: r274446
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r-- | gcc/ada/sem_ch4.adb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 6272578..16614ed 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -4994,7 +4994,15 @@ package body Sem_Ch4 is if Comp = First_Private_Entity (Type_To_Use) then if Etype (Sel) /= Any_Type then - -- We have a candiate + -- If the first private entity's name matches, then treat + -- it as a private op: needed for the error check for + -- illegal selection of private entities further below. + + if Chars (Comp) = Chars (Sel) then + Is_Private_Op := True; + end if; + + -- We have a candidate, so exit the loop exit; |