# Compiler segfault

**URL:** <https://ziggit.dev/t/compiler-segfault/3250>\
**Category:** Help\
**Tags:** compiler, build-system\
**Created:** [February 13, 2024, 5:13pm UTC](https://ziggit.dev/t/compiler-segfault/3250 "2024-02-13T17:13:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johnny](https://ziggit.dev/user_avatar/ziggit.dev/johnny/32/3947_2.png) [@Johnny](https://ziggit.dev/u/Johnny)\
**Post date:** [February 13, 2024, 5:13pm UTC](https://ziggit.dev/t/compiler-segfault/3250/1 "2024-02-13T17:13:52Z")

</div>

I was working on cross compiled ELF binary for ESP32 and managed to crash compiler on my x86-64 machine.  
Zig v0.11 on FreeBSD 15-CURRENT.

```zig
zig build-exe esp32.elf Debug riscv32-freestanding-eabi: error: the following command terminated unexpectedly:
/usr/local/bin/zig build-exe /usr/home/johnny/esp32/zig-compiler-segfault/src/main.zig --cache-dir /usr/home/johnny/esp32/zig-compiler-segfault/zig-cache --global-cache-dir /home/johnny/.cache/zig --name esp32.elf -target riscv32-freestanding-eabi -mcpu generic_rv32+c+m --listen=-
Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install esp32.elf transitive failure
   └─ zig build-exe esp32.elf Debug riscv32-freestanding-eabi failure
error: the following build command failed with exit code 1:
/usr/home/johnny/esp32/zig-compiler-segfault/zig-cache/o/d38675a4df95c6c71ea70b9bbcd68b1d/build /usr/local/bin/zig /usr/home/johnny/esp32/zig-compiler-segfault /usr/home/johnny/esp32/zig-compiler-segfault/zig-cache /home/johnny/.cache/zig

```

Even if my code is incorrect for compile time, it would be nice to have some printout where error might be.  
I found this error with bisecting the code (commenting things until it compiles).

Here is [minimal reproducer on Github](https://github.com/JohnnyZig/zig-riscv-compiler-segfault)  
Is this worth a Github PR?

---

<div class="post-metadata">

**Author:** ![bnl1](https://ziggit.dev/user_avatar/ziggit.dev/bnl1/32/1464_2.png) [@bnl1](https://ziggit.dev/u/bnl1)\
**Post date:** [February 13, 2024, 6:52pm UTC](https://ziggit.dev/t/compiler-segfault/3250/2 "2024-02-13T18:52:37Z")

</div>

> [@Johnny](#):
>
> Is this worth a Github PR?

Probably not, cannot reproduce on master, so it seems fixed.
