Skip to content

Compiler out-of-memory on String[] splat #2283

@NotsoanoNimus

Description

@NotsoanoNimus

Command: c3c compile-run main.c3

Message: Error: The compiler ran out of memory! Over 512 MB was allocated from a single memory arena, perhaps you called some recursive macro?

Code:

macro @do_splat_thing(#args)
{
    String[] args = { "program-name", ...(String[])#args };
    // ...
}

fn int main(String[] args)
{
    @do_splat_thing({ "str1","str1","str1","str1","str1","str1","str1" });   // 7 elements - ok
    @do_splat_thing({ "str1","str1","str1","str1","str1","str1","str1","str1" });   // 8 elements - causes compiler OOM
    return 0;
}

Also happens with String[] args = { ...(String[])#args }; when the #args parameter is a slice containing 9 values.

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingFixed needs testingNeeds verification / testing that it now works

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions