https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78879
--- Comment #6 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- (In reply to Yuan Pengfei from comment #5) > (In reply to Markus Trippelsdorf from comment #3) > > (In reply to Yuan Pengfei from comment #2) > > > (In reply to Markus Trippelsdorf from comment #1) > > > > See discussion in PR72785. > > > > > > I am using GCC 6.2.1. Is it the same problem? > > > > Yes, I think so. The compiler is under no obligation to optimize the > > ____ilog2_NaN call away. It looks like a kernel bug. > > I don't think so. In this case, the value of sector_size is constant (256, > 512, 1024, 2048, 4096) and the ____ilog2_NaN call can be optimized away. > > It is after enabling the -fprofile-generate option when the compiler thinks > the ____ilog2_NaN call can not be optimized away. > > Reference source code: > http://lxr.free-electrons.com/source/drivers/scsi/sd.c?v=3.10#L2163 Yes, sorry I got that the wrong way round. The compiler is under no obligation not to duplicate (optimize) and thereby produce that ____ilog2_NaN undefined symbol.