[clang] [llvm] [BasicAA] Fix miscompilation with setjmp/longjmp due to missing longjmp re-entry paths in alias analysis (PR #212297)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 17 02:22:29 PDT 2026


================
@@ -192,6 +192,14 @@ class LLVM_ABI EarliestEscapeAnalysis final : public CaptureAnalysis {
   /// This is used for cache invalidation purposes.
   DenseMap<Instruction *, TinyPtrVector<const Value *>> Inst2Obj;
 
+  /// Whether the function contains a call to a function that may return
+  /// twice (e.g. setjmp). Lazily computed and cached, since a `longjmp` may
+  /// re-enter the function at any such call, which this analysis needs to
+  /// account for conservatively.
+  std::optional<bool> ContainsReturnsTwiceCall;
+
+  bool containsReturnsTwiceCall();
----------------
midhuncodes7 wrote:

Addressed as commented

https://github.com/llvm/llvm-project/pull/212297


More information about the cfe-commits mailing list