http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49642
Summary: constant part of a macro not optimized away as expected due to splitter Product: gcc Version: tree-ssa Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: mar...@jet.franken.de my Linux kernel builds on gcc 4.6 pcc64 fail with: ERROR: ".____ilog2_NaN" [drivers/infiniband/hw/ehca/ib_ehca.ko] undefined! This comes from include/linux/log2.h which uses a large macro with builtin_constant_p() to optimize constant ilog2 calls. I have reduced it to the attached testcase. $ gcc -m64 -O2 -fno-inline-functions-called-once -c ehca_mrmw.i ; objdump -dr ehca_mrmw.o |grep NaN 1a8: R_PPC64_REL24 ____ilog2_NaN 1cc: R_PPC64_REL24 ____ilog2_NaN $ It should not report NaN as that is in a if (__builtin_constant_p(shca->hca_cap_mr_pgsize)) expression.