odin-lang / Odin

Odin Programming Language
https://odin-lang.org
BSD 3-Clause "New" or "Revised" License
6.1k stars 550 forks source link

Very long expressions cause stack overflow during type checking #3837

Open Beefster09 opened 2 days ago

Beefster09 commented 2 days ago

Context

        Odin:    dev-2024-06:80592f0f5
        OS:      Windows 10 Home Basic (version: 22H2), build 19045.4529
        CPU:     Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
        RAM:     65343 MiB
        Backend: LLVM 17.0.1

Expected Behavior

No matter how long an expression is, the compiler should either be able to compile or it should refuse to compile it with a helpful error message.

Current Behavior

While typechecking a long series of compilie-time string concatenations, the compiler has a stack overflow.

It's possible the overflow threshold is lower on Windows, as this same file did not cause trouble on Linux.

Confirmed that a workaround is to represent that giant string another way

Failure Information (for bugs)

Seems to be reproduced consistently on a file I have in my project that creates a long list of icons and their names in one big string.

Steps to Reproduce

  1. unzip the files into a package called icons
  2. import the package
  3. in main, print ALL_THE_ICONS with fmt.println

You can probably create a similar test case quite easily

Useful Files

icons-odin.zip

Feoramund commented 2 days ago

I'm able to reproduce this on Linux, but I need an absurd amount of text/concatenations to do it.

Kelimion commented 2 days ago

Confirmed on Windows. It works up to this point, but allow ARROW_UP_RIGHT + " ARROW_UP_RIGHT\n" and it's busted.

image