gcc does not reduce the function call to the result if called function is not static when using -O2, only with -O3, clang and msvc do the optimization also with -O2

Eric Botcazou botcazou@adacore.com
Sat Dec 5 13:25:31 GMT 2020


> can someone explain to me why the -O2 optimizer is not able(allowed) to
> reduce this small sample the same way as clang/msvc?

Change the name of the function to something else than "main".

-- 
Eric Botcazou




More information about the Gcc mailing list