-
Notifications
You must be signed in to change notification settings - Fork 263
c2rust transpile
always crashes on aarch64-unknown-linux-gnu
using clang 10
#433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think #383 is related to this, in that it fixes the issue on clang >10, but clang 10 doesn't have the #378 also seems like it might be related. |
#383 is definitely related, as you mention. When writing 294a088 I thought the SVE types were introduced with Clang 11, but they do indeed seem to have been in Clang 10 (despite the API we use to deal with them, as you note, being introduced in Clang 11). I'll do some archaeology and try to see what the right way to handle them in Clang 10 is. |
Is clang 10 the earliest version we're still supporting? It'd be great to at least support clang 10, though, since we use that by default. |
I think we support earlier versions (README says 7 or later), but they don't have the SVE types that cause this issue. Does aa0dda8 seem to fix the problem? |
I'll test aa0dda8 now, but LLVM 7-10 all have this same SVE error, not just 10. |
auto *llvmType = CodeGenTypes::ConvertType(T->desugar());
if (BTy->getKind() == BuiltinType::SveBool)
return Ctx.UnsignedCharTy;
|
Ugh, that'll teach me to write code in an The I'm confused how SVE-related errors could be appearing when compiling against Clang 9 and below--as far as I can tell, those types aren't defined until Clang 10. E.g., ripgrep doen't find any relevant code searching for |
I'm realizing the SVE errors in older clangs might actually be a testing mistake on my end. I was running |
I fixed the |
I've updated the |
Great, it compiles now! I get an error running it, though: warning: c2rust: Encountered unsupported BuiltinType kind 109 for type _Float16
1 warning generated.
Transpiling empty.c
thread 'main' panicked at 'Type conversion not implemented for TagTypeUnknown expecting 3', c2rust-transpile/src/c_ast/conversion.rs:829:22 Let me look into that. |
That's weird; I can't reproduce that error again anymore. |
And it works in clang 9 as well (so I assume older version are fine, too). The error I saw earlier must've been because of |
When linked to clang 10 (and 7, 8, and 9, all the version supported on Ubuntu 20), as in the Docker image and CI,
c2rust transpile
always crashes onaarch64-unknown-linux-gnu
. This includes crashing on a completely empty C file and a minimalcompile_commands.json
, as well as any other C files I test. It does not happen in clang >10, but it does in clang 10, 9, 8, and 7, and I'm not sure about <7.For example, using this compilation database at
tests/empty.aarch64/compile_commands.json
(you need to adjust thedirectory
since it must be an absolute path):and running:
you get the above error.
It seems to be due to unrecognized
__SV*_t
builtin types, which are from arm64 scalable vector extensions. These are unsupported by c2rust, so we should find a way to turn them off as long as we are still building on clang 10.Note the
warning: c2rust: Encountered unsupported BuiltinType kind * for type __SV*_t
warnings are fromc2rust-ast-exporter/src/AstExporter.cpp:353
in the functionTypeEncoder::VisitBuiltinType
:There's an explicit
#if CLANG_VERSION_MAJOR >= 11
check that handles SVE builtin types, so that might be the cause of the panic.The text was updated successfully, but these errors were encountered: