https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116767
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I bet const on the function type is treated as __attribute__((const)) on it, because the latter uses TREE_READONLY on the FUNCTION_TYPE. Of course, the function really is const in the testcase, so optimizing the call away is just fine, but bet if you change it such that it has side-effects it would be miscompiled.