I have a sample file here:
#include #include int main(){ printf(\"%f\\n\", log(10)); }
When I compile it
For some reasons gcc optimizes log(const) even with -O0. So there's no log() call in the first case. Check assembly to verify:
gcc sample.c -S
clang, for example doesn't optimize it out on O0. But at O2 gcc optimizes the call in both cases.