[clang] [llvm] [mlir] [Clang][CodeGen] Start migrating away from assuming the Default AS is 0 (PR #88182)

Alex Voicu via cfe-commits cfe-commits at lists.llvm.org
Mon May 27 11:57:34 PDT 2024


================
@@ -368,7 +368,8 @@ CodeGenModule::CodeGenModule(ASTContext &C,
   IntTy = llvm::IntegerType::get(LLVMContext, C.getTargetInfo().getIntWidth());
   IntPtrTy = llvm::IntegerType::get(LLVMContext,
     C.getTargetInfo().getMaxPointerWidth());
-  Int8PtrTy = llvm::PointerType::get(LLVMContext, 0);
+  Int8PtrTy = llvm::PointerType::get(LLVMContext,
----------------
AlexVlx wrote:

This seems to be an error on ASAN's side, it's relying on non-guaranteed behaviour and linking BC emanating from different languages with different AS maps. To wit, 0 is private for OCL, so having `llvm.used` and `llvm.compiler.used` be global arrays of pointers to private is somewhat suspect. I will / should fix `emitUsed` to rely on GlobalsInt8PtrTy, which seems like the right thing to do anyway, but whilst that'll make ASAN "work", it doesn't make ASAN correct, IMHO.

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


More information about the cfe-commits mailing list