https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448
Sam James <sjames at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|needs-reduction | Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #20 from Sam James <sjames at gcc dot gnu.org> --- This reduces to: ``` int a; void abort(); _Bool y_map_existsStringKey_v() __attribute__((pure)); _Bool y_map_existsStringKey_v(int *m, char *, void *val_ptr) { char **b = val_ptr; *b = m; return 1; } void pthread_getspecific(); void y_assert_fail() { abort(); } void main() { int *stack = 0; pthread_getspecific(); if (y_map_existsStringKey_v(&a, 0, &stack)) stack || (y_assert_fail(), 0); } ``` y_map_existsStringKey_v is NOT a candidate for pure, as it has side-effects (it modifies val_ptr). Indeed, dropping the pure attribute from y_map_existsStringKey_v on the original fixes it too.