General protocol for reporting compiler segmentation faults

i just added “some incredibly esoteric code” to my app, and the compiler produced a segmentation fault with little/no information… and for whatever reason, i’m having a hard time creating a small, standalone example that fails in the same way…

i’m currently on 0.13.0; should i try the latest 0.14.0 dev version???

are there some additional switches i could throw, which might yield some intermediate information of help to the team???

this hasn’t happened all that often to me – but when it does :angry:

you could try to see if it’s something that was fixed in the meantime, or if the bug is still present, in which case you might want to open an issue

a debug build of the compiler would probably tell your more but, regardless, if you’re having trouble creating a reduction, then the next best thing is pushing the code somewhere so that it can be reproduced by cloning and building.

here’s a tagged release with some notes about what i’ve tried and how to reproduce the segmentation fault…

in the meanwhile, i’ll continue trying to reduce the problem…

To minimize the zig code that crashes the compiler, you can use zig reduce.

zig reduce tries to minimize your zig code by applying transformations and after each transformation calls a checker script to see if zig crashes (interesting case) or not (boring case).

See: zig reduce --help and zig/lib/compiler/reduce.zig at master · ziglang/zig · GitHub

1 Like

In general I don’t get a segmentation fault with the dev version. But there are some “minor” changes in std.builtin with the current dev version (thanks to @mlugg :wink:), see std: update `std.builtin.Type` fields to follow naming conventions by mlugg · Pull Request #21225 · ziglang/zig · GitHub. But I think you need only 5 minutes to fix them. I did it for Ziglings right now, so I know what I’m talking about. :smile:

@kristoff – i’ve devised another (probably correct :wink:) implementation of the feature at hand, which no longer crashes the compiler…

good news, bad news i suppose…

i’ll leave that tagged release in place (should anyone want to investigate further), but i’m no longer blocked by the issue…