| ▲ | kccqzy 6 hours ago | ||||||||||||||||
Excellent debugging journey. If I were the author, I would skip the part about using the compiler explorer and reading the assembly. When I write C code, I need to satisfy the rules of the C language. Unless I’m debugging the compiler or dealing with performance issues, my experience is that reading the generated assembler and understanding it is usually a slow way of debugging. The author eventually did compile with -fsanitize=undefined but I would honestly do that first. It prints a nice error message about the exact issue as the author has shown. | |||||||||||||||||
| ▲ | direwolf20 6 hours ago | parent | next [-] | ||||||||||||||||
I have to disagree. If you merely want to fix the problem, you can stop as soon as you find something that's awry and whose alteration removes the problem. But don't you want to understand the problem? Don't you want to see how the compiler can reasonably generate code that says a bool variable is true and false at the same time? | |||||||||||||||||
| |||||||||||||||||
| ▲ | niobe 4 hours ago | parent | prev [-] | ||||||||||||||||
I think that's the kind of intuitive decision that comes from years of troubleshooting experience. It's not obvious that would be the place to start. It's impressive to me at least he got there. | |||||||||||||||||