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, kevinb@redhat.com
Subject: [PATCH v2 0/1] gdb, fortran: Fix local variable lookup in Fortran parser
Date: Thu, 30 Apr 2026 18:29:54 +0200	[thread overview]
Message-ID: <20260430162955.295647-1-abdul.b.ijaz@intel.com> (raw)

This change fixes https://sourceware.org/bugzilla/show_bug.cgi?id=34059.

The Fortran expression parser in GDB ("gdb/f-exp.y") previously performed
symbol lookup in this order when parsing identifiers:

- SEARCH_STRUCT_DOMAIN (types/structs)
- SEARCH_VFT ("C-like" name lookups for variables/types/functions)
- SEARCH_MODULE_DOMAIN (modules)

It searched for "types before variables", causing type names from shared
libraries to shadow local variable names.

This issue is fixed in the Fortran expression parser in GDB ("gdb/f-exp.y")
by prioritizing SEARCH_VFT over other search domains during symbol lookup.

Changes since V1:
- Fix this feedback from Kevin:
 https://sourceware.org/pipermail/gdb-patches/2026-April/227028.html

Thanks & Best Regards,
Abdul Basit

Abdul Basit Ijaz (1):
  gdb, fortran: Fix local variable lookup in Fortran parser

 gdb/f-exp.y                                   |  2 +-
 .../gdb.fortran/var-type-precedence-lib.c     | 30 ++++++++++
 .../gdb.fortran/var-type-precedence.exp       | 60 +++++++++++++++++++
 .../gdb.fortran/var-type-precedence.f90       | 40 +++++++++++++
 4 files changed, 131 insertions(+), 1 deletion(-)
 create mode 100644 gdb/testsuite/gdb.fortran/var-type-precedence-lib.c
 create mode 100644 gdb/testsuite/gdb.fortran/var-type-precedence.exp
 create mode 100644 gdb/testsuite/gdb.fortran/var-type-precedence.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-04-30 16:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30 16:29 Abdul Basit Ijaz [this message]
2026-04-30 16:29 ` [PATCH v2 1/1] " Abdul Basit Ijaz
2026-05-01 17:47   ` Kevin Buettner
2026-05-04  7:05     ` Ijaz, Abdul B

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=20260430162955.295647-1-abdul.b.ijaz@intel.com \
    --to=abdul.b.ijaz@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    --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