When running odin check <dir> and there are way more errors than the maximum error collector count (36), there is a chance to get a segfault.
I initially discovered this when working on my project with the odin language server. ols will run odin check when the file is saved to report any errors. I've configured ols to run odin check with -vet-semicolon. The problem is, a 3rd party package i use is full of them, so a huge amount of errors get reported. But because odin segfaults, ols will fail to properly capture its output and will not report them.
Operating System & Odin Version:
Odin: dev-2024-02:cec08114
OS: NixOS 24.05 (Uakari), Linux 6.1.75
CPU: Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
RAM: 15754 MiB
Expected Behavior
Odin should not segfault once it has reached the maximum amount of reported errors and instead exit normally.
Current Behavior
Assuming a directory with more than two files and enough errors (>36), a segfault might happen.
It should be noted that the more errors there are the greater the chance for the segfault.
1 Create a directory with two files and copy paste the following content:
package main
// name it proc2 for the second file
proc1 :: proc() {
= 1;
... // Repeat many times, >50 should be enough.
= 1;
}
- 2 Alternatively, i've attached these files to this bug report.
[bug_report.zip](https://github.com/odin-lang/Odin/files/14154499/bug_report.zip)
- 3 Run `odin check <dir> -no-entry-point -vet-semicolon` multiple times, until a segfault happens.
Context
When running
odin check <dir>
and there are way more errors than the maximum error collector count (36), there is a chance to get a segfault.I initially discovered this when working on my project with the odin language server. ols will run
odin check
when the file is saved to report any errors. I've configured ols to runodin check
with-vet-semicolon
. The problem is, a 3rd party package i use is full of them, so a huge amount of errors get reported. But because odin segfaults, ols will fail to properly capture its output and will not report them.Expected Behavior
Odin should not segfault once it has reached the maximum amount of reported errors and instead exit normally.
Current Behavior
Assuming a directory with more than two files and enough errors (>36), a segfault might happen. It should be noted that the more errors there are the greater the chance for the segfault.
Failure Information (for bugs)
Attaching a debugger shows that the segfault happens after https://github.com/odin-lang/Odin/blob/4e300ff90a0d4b9d706a21a9fc155aa1536d934c/src/error.cpp#L438
Steps to Reproduce
// name it proc2 for the second file proc1 :: proc() { = 1; ... // Repeat many times, >50 should be enough. = 1; }