Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Abdul Basit Ijaz <abdul.b.ijaz@intel.com>
To: gdb-patches@sourceware.org
Cc: abdul.b.ijaz@intel.com, tom@tromey.com
Subject: [PATCH v2 0/1] gdb/dwarf: Use the function scope for DW_TAG_imported_declaration
Date: Mon,  4 May 2026 10:34:39 +0200	[thread overview]
Message-ID: <20260504083440.387223-1-abdul.b.ijaz@intel.com> (raw)

All Fortran imported variable aliases (`use module, alias => var`)
were being added to "global scope", regardless of whether they appeared
in:
- Program/module scope (should be global)
- Function scope (should be local)

This caused conflicts when different functions had the same alias name
pointing to different variables.

This patch modifies the case for DW_TAG_imported_declaration in the
function new_symbol () to use cu->list_in_scope instead of global
symbols for all languages.  This ensures that function-scoped aliases
use the current scope rather than being forced into the global scope.

Changes since V1:
- Fixes the feedback from Tom:
https://sourceware.org/pipermail/gdb-patches/2026-May/227098.html

Thanks & Best Regards,
Abdul Basit

Abdul Basit Ijaz (1):
  gdb/dwarf: Use the function scope for DW_TAG_imported_declaration

 gdb/dwarf2/read.c                             | 10 +++
 .../gdb.fortran/module_declarations.exp       | 62 +++++++++++++++++++
 .../gdb.fortran/module_declarations.f90       | 59 ++++++++++++++++++
 3 files changed, 131 insertions(+)
 create mode 100644 gdb/testsuite/gdb.fortran/module_declarations.exp
 create mode 100644 gdb/testsuite/gdb.fortran/module_declarations.f90

-- 
2.34.1

Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


             reply	other threads:[~2026-05-04  8:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-04  8:34 Abdul Basit Ijaz [this message]
2026-05-04  8:34 ` [PATCH v2 1/1] " Abdul Basit Ijaz
2026-05-05 14:23   ` Tom Tromey

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=20260504083440.387223-1-abdul.b.ijaz@intel.com \
    --to=abdul.b.ijaz@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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