[all-commits] [llvm/llvm-project] 20c6b9: [flang][debug] Fix issues with local variables. (#...

Abid Qadeer via All-commits all-commits at lists.llvm.org
Wed Jul 17 02:46:34 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 20c6b9fbba583d172e931dd24417784186136531
      https://github.com/llvm/llvm-project/commit/20c6b9fbba583d172e931dd24417784186136531
  Author: Abid Qadeer <haqadeer at amd.com>
  Date:   2024-07-17 (Wed, 17 Jul 2024)

  Changed paths:
    M flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
    M flang/test/Integration/debug-fixed-array-type-2.f90
    A flang/test/Transforms/debug-local-global-storage-1.fir

  Log Message:
  -----------
  [flang][debug] Fix issues with local variables. (#98661)

This PR fixes 2 similar issues.
1. As reported in #97476, flang generated executable has inconsistent
behavior regarding values of the local array variables.
2. Variable with save attribute would not show up in debugger.

The reason behind is same for both cases. If a local variable has
storage which extends beyond function lifetime, the way to represent it
in the debug info is through a global variable whose scope is limited to
the function. This is what is used for static local variable in C.
Previously local array worked in cases they were on stack. But will not
show up if they had a global storage.

To fix this, if we can get a corresponding `GlobalOp` for a variable
while processing `DeclareOp`, we treat it the variable as global with
scope set appropriately. A new FIR test is added. A previous Integration
test has been adjusted as to not expect local variables for local
arrays.

With this fix in place, all the issues described in #97476 go away. It
also fixes a lot of fails in GDB's fortran testsuite.

Fixes #97476.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list