https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61144
--- Comment #20 from Rich Felker <bugdal at aerifal dot cx> --- On further investigation, it looks like the code I cited deals with strong aliases as well as weak ones, and in the strong alias case, the strong folding behavior might be desirable. A better fix seems to be adding an explicit check for weak aliases (DECL_WEAK(decl)) when an alias is found and returning error_mark_node in that case. Note that prior to the above-mentioned commit, the !TREE_READONLY(decl) case was always treated as non-foldable, so there seems to have been no subtlety to avoiding errors with weak aliases. But the new code performs much more aggressive constant folding and thus needs to avoid stepping on weak aliases.