https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85974
Bug ID: 85974
Summary: Failure to optimize difference of two pointers into a
compile time constant
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: pkoning at gcc dot gnu.org
Target Milestone: ---
This issue is exposed by test case testsuite/gcc.c-torture/compile/930326-1.c,
on platforms where ptrdiff_t is not "long" (such as pdp11). In that case, the
last line:
long i = s.f-&s.b;
fails with "error: initializer element is not computable at load time".
It's not a target bug; the problem can be reproduced for other targets by
changing the "long" to "char" in that statement.