public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "simon at pushface dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/107536] New: [12 regression] Wrong 'not referenced' warning on renamed variable
Date: Sat, 05 Nov 2022 17:00:11 +0000	[thread overview]
Message-ID: <bug-107536-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2022-11-05 17:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-05 17:00 simon at pushface dot org [this message]
2022-11-07  7:01 ` [Bug ada/107536] [12/13 " rguenth at gcc dot gnu.org
2022-11-08 11:29 ` simon at pushface dot org
2023-05-08 12:25 ` [Bug ada/107536] [12/13/14 " rguenth at gcc dot gnu.org
2023-05-11 15:49 ` ebotcazou at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-107536-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).