Skip to content

c2rust-transpile/c_ast/conversion: workaround for unknown node #378

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

Closed
wants to merge 1 commit into from

Conversation

orangecms
Copy link

Not exactly sure what would need to be done here. Feedback would help a lot! :-)

c2rust transpile compile_commands.json yielded:

thread 'main' panicked at 'Type conversion not implemented for TagTypeUnknown expecting 3', c2rust-transpile/src/c_ast/conversion.rs:795:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Sorry for the big change; it looks like the code was unformatted, and my setup runs rustfmt automatically.

@thedataking
Copy link
Contributor

Did you isolate the code construct that causes the problem? Suggestions on how to proceed:

  1. Provide a code snippet that triggers the issue in the PR description (or at least info on how to reproduce)
  2. If you want to reformat the code, that should be a separate, non-functional commit.

@fw-immunant
Copy link
Contributor

It's more likely that what you want to do here (instead of adding a case for TypeTag::TagTypeUnknown to the match on ty_node.tag in ConversionContext::visit_node) is add a case to VisitBuiltinType in c2rust-ast-exporter/src/AstExporter.cpp. It may help to print out some debugging info in the default case there first, to find out what the kind of the unhandled builtin type you're encountering is. You may have to consult clang's BuiltinTypes.def (or, less likely, one of the other .def files mentioned here) to decode the integral kind value to something human-readable.

@fw-immunant
Copy link
Contributor

I ran into the same error while adding a trivial AArch64 test in #383, and added improved diagnostics in that PR, as well as a fix for the root cause when transpiling C→Rust on AArch64 (which may be different from the root cause of your encounter with this error).

See if that branch (or master after the PR merges) still gives you an error, and if so please post the output, which should now include the name of the type causing it.

@fw-immunant
Copy link
Contributor

Closing as the root cause of this bug may have been resolved by now and if not, when the issue recurs it'll come with more debugging information to distinguish it from issues we've already solved. Please file an issue if you still encounter issues with master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants