Skip to content

Compiler deficiencies compiling Nextvi #247

@kyx0r

Description

@kyx0r

Hello, I'm compiling Nextvi:

./xcc -I /usr/include nextvi/vi.c

/usr/include/bits/alltypes.h(326): `;' or `,' expected
typedef __builtin_va_list va_list;
                          ^~~~~~~
/usr/include/bits/alltypes.h(326): unexpected token
typedef __builtin_va_list va_list;
                          ^~~~~~~
Assertion failed: type->struct_.info != NULL (src/cc/frontend/type.c: type_size: 206)

These are 2 separate problems. First va_list, this should be a trivial fix. Just parse the builtin and ignore.
The second one is a compiler deficiency with struct forward declarations.

// Reproducer for: typedef struct forward-decl + VLA = assertion failure
//
// Compile:
//   $ ./xcc examples/echo.c

typedef struct Foo Foo;

struct Foo {
    int x;
    int y;
};

void use(Foo *p);

void test(int n) {
    Foo arr[n];   // VLA: triggers type_size(Foo) via typedef -> incomplete type
    use(arr);
}
cc1: src/cc/frontend/type.c:206: type_size: Assertion `type->struct_.info != NULL' failed.

I'm interested in the project. The compiler looks promising. Could be a great tool for me if these are the only issues right now from having Nextvi compiling.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions