4 ms·
I once found a compiler bug in C#/.NET , this must have been ten years ago by now. I was a junior dev debugging some weird problem with a desktop app. The code
by junek 4y ago
I once found a compiler bug in C#/.NET , this must have been ten years ago by now. I was a junior dev debugging some weird problem with a desktop app.
The code was something like:
if (foo.bar < 5) {
a()
} else {
b()
}
But `b()` would never get called. I stepped through with a debugger, checking the relevant values,and the `else` branch would never execute.
I remember inspecting the IR and seeing that yes, in fact, the `else` branch was simply missing. It would come back if I made a trivial change like deleting a blank line before the conditional block, which lead me to believe the compiler must be getting into a weird state somehow.
I showed my work to the senior engineers and they confirmed that yes this was a compiler bug. We submitted a bug report to MS but never heard back from them. I wonder if it ever got fixed?