Skip to content

Assertion failed: (isInt() && "Invalid accessor"), function getInt, file APValue.h, line 416. #1140

@jrmuizel

Description

@jrmuizel

I get this when running c2rust translate on the following source code:

typedef struct Scope Scope;
struct Scope {
        Scope *next;
};

static Scope *scope = &(Scope){};

I'm running c2rust on macOS with llvm 17.0.6

The stack looks something like:

* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = hit program assert
    frame #0: 0x00000001907aaa60 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x00000001907e2c20 libsystem_pthread.dylib`pthread_kill + 288
    frame #2: 0x00000001906efa20 libsystem_c.dylib`abort + 180
    frame #3: 0x00000001906eed10 libsystem_c.dylib`__assert_rtn + 284
  * frame #4: 0x00000001007a6ca0 c2rust-transpile`clang::APValue::getInt(this=0x000000016fdf9290) at APValue.h:416:5
    frame #5: 0x00000001007a68e0 c2rust-transpile`TranslateASTVisitor::evaluateConstantInt(this=0x000000016fdf9c20, E=0x000000012c0bf140, constant=0x000000016fdf9370) at AstExporter.cpp:604:40
    frame #6: 0x00000001007c91c4 c2rust-transpile`TranslateASTVisitor::VisitConstantExpr(this=0x000000016fdf9c20, E=0x000000012c0bf140) at AstExporter.cpp:1745:25
    frame #7: 0x000000010078c5d8 c2rust-transpile`clang::RecursiveASTVisitor<TranslateASTVisitor>::WalkUpFromConstantExpr(this=0x000000016fdf9c20, S=0x000000012c0bf140) at StmtNodes.inc:1167:1
    frame #8: 0x000000010078c3e0 c2rust-transpile`clang::RecursiveASTVisitor<TranslateASTVisitor>::TraverseConstantExpr(this=0x000000016fdf9c20, S=0x000000012c0bf140, Queue=0x000000016fdf9650) at RecursiveASTVisitor.h:2427:1
    frame #9: 0x000000010076d260 c2rust-transpile`clang::RecursiveASTVisitor<TranslateASTVisitor>::dataTraverseNode(this=0x000000016fdf9c20, S=0x000000012c0bf140, Queue=0x000000016fdf9650) at StmtNodes.inc:1167:1
    frame #10: 0x00000001006321a0 c2rust-transpile`clang::RecursiveASTVisitor<TranslateASTVisitor>::TraverseStmt(this=0x000000016fdf9c20, S=0x000000012c0bf180, Queue=0x0000000000000000) at RecursiveASTVisitor.h:686:7

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