This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/49642] New: constant part of a macro not optimized away as expected due to splitter
- From: "marcus at jet dot franken.de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 5 Jul 2011 12:40:23 +0000
- Subject: [Bug c/49642] New: constant part of a macro not optimized away as expected due to splitter
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: marcus@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.