[clang] [clang][CodeGen] Fix a crash caused by inconsistent addrspace (PR #236752)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 29 22:18:53 PDT 2026


================
@@ -176,9 +176,11 @@ bool CodeGenModule::TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D) {
   // requires explicit comdat support in the IL.
   if (llvm::GlobalValue::isWeakForLinker(TargetLinkage))
     return true;
-  // Create the alias with no name.
-  auto *Alias = llvm::GlobalAlias::create(AliasValueType, 0, Linkage, "",
-                                          Aliasee, &getModule());
+
+  // Create the alias with no name, in the same address space as the aliasee.
+  auto *Alias = llvm::GlobalAlias::create(
+      AliasValueType, getDataLayout().getProgramAddressSpace(), Linkage, "",
----------------
arsenm wrote:

Taking the context specific value is of course better because that doesn't hardcode the assumption that there is only one program address space 

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


More information about the cfe-commits mailing list