sparse bad constant expression caused by 7322dd755e7d ("byteswap: try to avoid __builtin_constant_p gcc bug", 2016-05-05)

From: Keller, Jacob E
Date: Tue Jun 21 2016 - 19:14:50 EST


Hi,

I recently ran into a sparse error when running sparse on Intel's i40e kernel driver against v4.7-rc3.

CC [M] drivers/net/ethernet/intel/i40e/i40e_nvm.o
include/linux/sctp.h:172:51: error: bad constant expression
include/linux/sctp.h:174:51: error: bad constant expression
include/linux/sctp.h:172:51: error: bad constant expression
include/linux/sctp.h:174:51: error: bad constant expression
include/linux/sctp.h:175:51: error: bad constant expression
include/linux/sctp.h:176:51: error: bad constant expression
include/linux/sctp.h:177:51: error: bad constant expression
include/linux/sctp.h:178:51: error: bad constant expression

And similar. I ran a bisect and determined the offending commit was 7322dd755e7d ("byteswap: try to avoid __builtin_constant_p gcc bug", 2016-05-05)

I am not sure if this is a regression in sparse, a real issue, or something else?

Thanks,
Jake