2 ms·
I caught a JIT bug in .NET back when I worked at Microsoft. Unfortunately I don't remember the specifics, but it was doing something wrong when trying to optimi
by cblum 6y ago
I caught a JIT bug in .NET back when I worked at Microsoft. Unfortunately I don't remember the specifics, but it was doing something wrong when trying to optimize a bit of code using AVX instructions.
I was immediately sure it was a compiler bug when I realized I could make the code work correctly if I changed the order of variable declarations. It would happen on something like:
int a;
int b;
float c;
(again, that's only illustrative - too long ago for me to remember the specifics)
But not with:
int a;
float c;
int b;
Folks in my team didn't want to believe it at first :)
Edit: found it here - https://github.com/dotnet/runtime/issues/17395 https://github.com/dotnet/runtime/issues/17395
Not quite as I described but close.
- pfdietz 6y agoThat not only shows it's a compiler bug (assuming the program had no undefined behavior), it gives a general technique for generating compiler tests. Take any program, randomly change the order of declarations in a way that doesn't alter the meaning of the program, and see if both versions have the same behavior on some set of inputs. This is an example of "metamorphic testing".