VS2019: Generated serialzation code is affected by compiler bug
Development toolkit for Web Services and XML data bindings for C & C++
Brought to you by:
engelen
Hello!
This ticket is for information only.
The generated code of gSoap is affected by this compiler bug, when compiled with VS2019 in Release mode. I found the bug by drilling down a problem with our Soap code after migrating to VS2019.
Best regards
Sönke Schau
Thank your for sharing this information. That must have been a frustrating bug!
I believe the compiler maps f1 and f2 to the same register. This happens in the register allocator that maps f1 and f2 to registers based on the coloring of the conflict graph computed from the live ranges of variables in the control flow graph. Apparently the two if-then paths in the loop are considered conflict-free for the live ranges of f1 and f2, which is not the case. I taught this stuff in my CS graduate course on compiler construction.
This reminds me of a bug I found years ago in a parallelizing compiler that refused to produce correct code to run on one processor, which I needed for performance evaluation. Then there was also a GCC bug on MacOS that would corrupt the stack. Two years ago I found a bug in Visual Studio 2015 in C++ range-based for loops that would crash because the temporary object to produce the range gets deleted too early, before the next loop iteration.
We tend to forget that compilers are software and this software like all else is not always 100% bug free.