Skip to content

bug: recursive #includes without #pragma once cause a stack overflow #629

@thetayloredman

Description

@thetayloredman

Before we begin...

  • I have updated the Zirco toolchain to the latest version
  • I have searched the issue tracker for duplicates

What happened?

When a file includes itself and does not have #pragma once set, then a stack overflow results.

What version of Zirco are you running?

zrc_cli 0.1.0 (commit unknown, release build, macos [aarch64])

(25d8172 via Nix)

How can this bug be reproduced?

file.zr

#include "file.zr"

What behavior did you expect?

An error for recursive includes, or some better diagnostic

What actually happened?

thread 'main' has overflowed its stack
fatal runtime error: stack overflow, aborting
make: *** [dist/cmds/version.o] Abort trap: 6

Other Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserRelating to the lexer or parserA-zppRelating to the preprocessor and includesE-help-wantedCall for participation: Help is wanted!P-highThe bug disrupts many use cases of the compilerT-bugSomething isn't working (use type: ice for panics)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions