Skip to content

Could not find type panic after math-related missing types warnings #1204

@tomaka

Description

@tomaka

When doing c2rust transpile astcenc_decompress_symbolic.cbe.c, I'm getting the following panic:

thread 'main' panicked at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/c2rust-transpile-0.20.0/src/c_ast/mod.rs:269:30:
Could not find CTypeId(292) in TypedAstContext
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Here's the input file: astcenc_decompress_symbolic.cbe.c

Note that this C file is auto-generated using https://github.com/JuliaHubOSS/llvm-cbe, but it compiles just fine with clang, and other similar auto-generated files work with c2rust without any issue.

GitHub wouldn't let me copy-paste the full build output in this issue (it's too long), so here it is attached: logs.txt

The panic follows a lot of warnings that look like this:

warning: Missing type 187650567825360 for node: AstNode { tag: TagFunctionDecl, children: [Some(187650567825208), None], loc: SrcSpan { fileid: 6, begin_line: 175, begin_column: 1, end_line: 175, end_column: 44 }, type_id: Some(187650567825360), rvalue: LValue, macro_expansions: [], macro_expansion_text: Some("__FSID_T_TYPE"), extras: [Text("_ZGVnN4v_exp10f"), Bool(true), Bool(false), Bool(false), Bool(false), Bool(false), Bool(false), Array([])] }
Exported Clang AST was invalid. Check warnings above for unimplemented features.
--> /usr/include/aarch64-linux-gnu/bits/math-vector.h:175:1
 [-Wclang-ast]

I'm not familiar with how c2rust works, but all the symbol names in these warnings related to math functions. However the input file doesn't make use of these math functions.

Any way to bypass the issue would be greatly appreciated 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions