Skip to content

C API type mismatch in ArrayType initializer #56496

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
nektro opened this issue Jul 12, 2022 · 2 comments
Closed

C API type mismatch in ArrayType initializer #56496

nektro opened this issue Jul 12, 2022 · 2 comments

Comments

@nektro
Copy link
Member

nektro commented Jul 12, 2022

https://github.com/llvm/llvm-project/blob/23d8eca/llvm/include/llvm/IR/DerivedTypes.h#L372-L373

https://github.com/llvm/llvm-project/blob/23d8eca/llvm/include/llvm-c/Core.h#L1429-L1437

C++ API use uint64_t and C API uses unsigned and thus gets truncated when trying to create larger ArrayTypes

@FnControlOption
Copy link

Please excuse my ignorance: is it as simple as changing unsigned to uint64_t in Core.h and Core.cpp?

https://github.com/llvm/llvm-project/blob/d71a8ad/llvm/lib/IR/Core.cpp#L778-L780

@nikic
Copy link
Contributor

nikic commented Dec 7, 2022

Please excuse my ignorance: is it as simple as changing unsigned to uint64_t in Core.h and Core.cpp?

https://github.com/llvm/llvm-project/blob/d71a8ad/llvm/lib/IR/Core.cpp#L778-L780

No, that would be an ABI break. Instead LLVMArrayType2 with the new type would have to be added.

@nikic nikic closed this as completed in 35276f1 Feb 15, 2023
CarlosAlbertoEnciso pushed a commit to SNSystems/llvm-debuginfo-analyzer that referenced this issue Feb 15, 2023
Fixes llvm/llvm-project#56496.

As mentioned in the issue, new functions LLVMArrayType2 and
LLVMGetArrayLength2 are created so as to not break the old API.
The old methods are then marked as deprecated and callers are
updated.

Differential Revision: https://reviews.llvm.org/D143700
veselypeta pushed a commit to veselypeta/cherillvm that referenced this issue Aug 12, 2024
Fixes llvm/llvm-project#56496.

As mentioned in the issue, new functions LLVMArrayType2 and
LLVMGetArrayLength2 are created so as to not break the old API.
The old methods are then marked as deprecated and callers are
updated.

Differential Revision: https://reviews.llvm.org/D143700
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants