https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98555
Bug ID: 98555
Summary: Functions optimized to zero length break function
pointer inequality
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: bugdal at aerifal dot cx
Target Milestone: ---
Given a function such as
void foo() { __builtin_unreachable(); }
or optimized to such due to unconditional undefined behavior when the function
is reached, GCC emits a zero-length function. This causes the address of foo to
be equal to the address of whatever function happens to follow foo, breaking
the language requirement that distinct functions' addresses compare not-equal.
As far as I can tell, all versions back to 4.x or earlier are affected.