[clang] [clang][CodeGen] Fix invalid bitcast in InitCatchParam for non-zero address space pointers (PR #224680)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 2 10:02:59 PDT 2026


================
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -fexceptions -fms-extensions -verify %s
+
+// Test for issue (https://github.com/llvm/llvm-project/issues/222931).
+// Reject throwing/catching pointers and references whose pointee/referred type
+// has a non-default address space; runtimes don't yet support cross-address-
+// space conversions.
+
+// catch of a reference to a pointer (T*&), are not rejected by the Mode/BaseType
+// check.
----------------
efriedma-quic wrote:

Oh, hmm, I think we actually do need to reject here?

In T*&, both the pointer and the reference need to be address-space zero, for different reasons.  (The reference points to a local alloca, the pointer is the pointer returned by cxa_begin_catch.)

Sorry, I didn't realize this would be an issue until now

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


More information about the cfe-commits mailing list