https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107536
Bug ID: 107536
Summary: [12 regression] Wrong 'not referenced' warning on
renamed variable
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: simon at pushface dot org
Target Milestone: ---
Created attachment 53834
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53834&action=edit
Demonstrator
If a record has aspect Volatile_Full_Access, a renaming of one of the record’s
components will be reported as unreferenced even though it plainly is.
$ gnatmake -gnatwa -c -u -f renaming.adb -gnatl
gcc -c -gnatwa -gnatl renaming.adb
GNAT 12.2.0
Copyright 1992-2022, Free Software Foundation, Inc.
Compiling: renaming.adb
Source file time stamp: 2022-11-05 16:48:11
Compiled at: 2022-11-05 16:50:40
1. procedure Renaming is
2.
3. type T is record
4. Item : Integer;
5. end record;
6. A_T : T;
7. Item : Integer renames A_T.Item;
8.
9. type VFA_T is record
10. Item : Integer;
11. end record
12. with Volatile_Full_Access;
13. A_VFA_T : VFA_T;
14. VFA_Item : Integer renames A_VFA_T.Item;
|
>>> warning: renamed variable "VFA_Item" is not referenced [-gnatwu]
15.
16. begin
17. Item := 42;
18. VFA_Item := 42;
19. end Renaming;
19 lines: No errors, 1 warning
This is also present on 12.1.0.