https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92412
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- The DECL_EXTERNAL is what should make the difference but IIRC a errno.h with a tentative definition would be conforming, no? And that woudln't be DECL_EXTERNAL ... TREE_READONLY should be handled more generally, /* If the reference is based on a decl that is not aliased the call cannot possibly clobber it. */ if (DECL_P (base) && !may_be_aliased (base) /* But local non-readonly statics can be modified through recursion or the call may implement a threading barrier which we must treat as may-def. */ && (TREE_READONLY (base) || !is_global_var (base))) return false; gives a hint (but doesn't apply here due to the var being address-taken). I think we could split out if (DECL_P (base) && TREE_READONLY (base)) return false; ? I know I'm usually overly cautionous with const vs non-const, but on decls it should work. OTOH... int var; const int const_var __attribute__((alias("var"))); is likely a valid way to "document" that some parts cannot modify 'var' but for int foo() { int tem = const_var; bar (); return const_var; } we cannot elide the second load because bar() might modify it via a store to 'var'. Likewise interposing a const int def with a non-const int def is probably OK. Thus we'd need to ask the varpool if 'base' is prevailing, look at the ultimate alias target and only take that vars const-ness into account... (ick).