[PATCH] D113741: [RFC][DwarfDebug][AsmPrinter] Support emitting function-local declaration for a lexical block

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 24 10:58:01 PST 2022


dblaikie added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1408-1409
+    }
+    DwarfCompileUnit *const *TheCUPtr = &TheCU;
+    return llvm::make_range(TheCUPtr, TheCUPtr + 1);
+  };
----------------
krisb wrote:
> dblaikie wrote:
> > This looks buggy - it's returning a pointer to a local variable (the `TheCU` pointer) which means it'll be dangling once the function returns, yeah? (I'd expect msan to catch this, for instance)
> Uuups, bad experiments. Fixed.
This code still looks buggy, it's still returning the address of a local variable (the address of "TheU" pointer) so it'd still be UB/dangling/msan-unclean, I think?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113741/new/

https://reviews.llvm.org/D113741



More information about the llvm-commits mailing list