https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785

--- Comment #28 from James Greenhalgh <jgreenhalgh at gcc dot gnu.org> ---
> As far as I can tell the kernel is the only project where this issue ever
> popped up. The fix is straightforward. It just needs to be send to the
> correct kernel maintainer.

Right, but getting the patch in mainline is the easy bit! This bug hits many
released kernels.

> Why do you think this case is any different from any other buggy application
> code that needs adjustments as gcc improves?

In most cases we improve GCC to exploit well defined behaviors of the standard.
In this case we created defined __builtin_constant_p with insufficient
documentation to allow a user to reasonably predict the surprising behavior
shown in this testcase.

GCC has created a path which will never be executed and used that to introduce
a constant which does not exist in the source. Unless you know what
jump-threading can do, this transformation isn't obvious.

Reply via email to