simont: A picture of me in 2016 (0)
simont ([personal profile] simont) wrote in [personal profile] diziet 2025-03-28 01:17 pm (UTC)

C nowadays is an insanely hostile programming environment. A C compiler relentlessly scours your program for any place where may have violated C’s almost incomprehensible rules, so that it can compile your apparently-correct program into a buggy executable.

Yesterday I had a C compiler optimise my main() into literally zero instructions. Not even a return instruction. It silently output an object file which would cause execution to fall off the bottom of main() into whatever the linker had happened to put next in the image!

The sin: a float-to-uint32 conversion with input value exactly 232, i.e. only just an overflow.

This was grounds to emit an executable that could not possibly be what anybody ever wanted. But not grounds to print so much as a compiler warning, even at -Wall!

Post a comment in response:

(will be screened)
(will be screened if not on Access List)
(will be screened if not on Access List)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting