[Mlir-commits] [mlir] [mlir][emitc] Fix creating pointer from constant array (PR #162083)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Oct 18 09:24:00 PDT 2025
Jimmy2027 wrote:
> But you can't correctly use pointer to const int right? In mlir you can pass the result of get_global from a constant global in a function call. In C you wouldn't be allowed to pass this to a function expecting a ptr to int/int array.
>
> So I think you will get compile errors in the generated code dependent in the users of the get_global with your changes right now. But maybe I'm wrong, I'd have to test this first.
But wouldn't that be a user mistake in any case? C++ doesn't even compile a non-const pointer of a const... I can't think of any meaningful example where this change breaks something that is not already broken but maybe I'm biased and missing something :)
The use case I'm working with is the one from the [testcase I added](https://github.com/llvm/llvm-project/pull/162083/files#diff-64724a9af240143a2f133042d3c016c9486d38588712c3f4e7d44ad622f6e6adR78) where I memcpy the const data somewhere. Without the fix this would currently not compile with g++
https://github.com/llvm/llvm-project/pull/162083
More information about the Mlir-commits
mailing list