Tamas K Lengyel

220 Followers
344 Following
194 Posts
Sr Principal Security Engineer at Oracle. Maintainer of Xen, DRAKVUF, LibVMI.
Homepagehttps://tklengyel.com
Perhaps even worse, even if you ask clang to produce a compiler warning for the undefined behavior with -Wnull-dereference you get nothing. At least gcc still does the right thing there:
The solution was: Nothing! It turns out that due to the undefined behavior of the NULL-pointer dereference in the beginning of main, clang's optimizer removes main entirely and you just get a call to _fini! No compile time warning, no runtime warning. All is fine in the land of C! 😜
It's one of those days where my multi-hour pipeline build fails at the last step because bash throws an error when it runs into "expr 0 - 0".