AVX register corruption from signal delivery
bugzilla.kernel.org
bugzilla.kernel.org
"Debugging an evil Go runtime bug" - https://news.ycombinator.com/item?id=15845118
https://github.com/golang/go/issues/20427
Of course there are also good reports where the user actually has found a bug in the compiler.
Though of course most are weird corner case or bugs in new features, there are a surprising number that make you think “wow, how could any program be successfully compiled which this bug in the tree?”
It manifested when you had a single static member of a specific generic type in a class. The program crashed complaining about invalid CLR instructions. If you added a second static member of the same type to the class, or changed the type of the generic parameter, it didn't reproduce.
Turns out it was related to how the compiler used AVX intrinsics on CPUs that supported those instructions.
Pretty fun but took some convincing for people to believe it was a compiler bug.
We found a stepping of a 486 chip where this code crashed about 25% of the time
Since it was only that stepping, and we already had a fallback path, we just skipped the optimization for that chip version and didn’t investigate exactly what was broken though
Having a lot of customers with various CPU versions helped to track this down pretty quickly
It was definitely the new instructions though, so whatever Intel chip had the new features had this 1 stepping that had this bug (and it wasn’t the first version of the chip either)
I don't know why people think compilers are so infallible, or are more likely to be better written than your application. If people write bugs in applications guess what the same people write similar bugs in compilers too.
Since they are rare and written by relatively small and knowledgeable people, most of the users (incl. me) think that they're meticulously tested and developed with utmost care.
I just remembered that one of my applications were hanging in a hot code path if I didn't write a small debug directive in the middle of it. I always thought the problem was with me but, it can be anywhere between me and the silicon. When you're in the middle of the development heat, you always blame your code or the libraries you use. Compiler and the lower levels are not put in the suspect list until bug becomes fairly stubborn to persist.
It definitely took me a while to realize that VS was just always executing the default statement of a switch (instead of an applying case) if the default was at the top of the switch instead of the bottom, and only when the switch was being executed at compile time in a constexpr context.
I also live in a log cabin in the back woods and can go off-grid. I've seen shit you people would not believe. It's just a matter of time now. Dominoes.
It is tough to not get overconfident in this diagnosis. If your code happens to see hardware problems on a routine basis, and a real bug surfaces, it is very challenging to not dismiss the latter for the former. It likely took impressive work to diagnose this as far as they have.
Because odds of user vs tool error are so great the software is commonly used. Otherwise it wouldn't be so popular.
In most cases the application is not meant to crash with any fault.
I wonder if this is a compiler bug or a new optimization that broke the code.
In this case, it might be necessary to do a volatile read in case that flag has changed, forcing the compiler to reload it.