https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65270
--- Comment #16 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Richard,
thanks, I also think alias trick makes gloal vars safe for merging across
RESTRICT flags.
One however needs to consider merging of items referring restricted vars.
const restrict int *a=&var;
const int *b = &var;
const int **ptrs1={&a};
const int **ptrs2=[&b};
with -fmerge-all-constants we may merge ptrs1 and ptrs2 and, in the late
compilation, in turn fold expression "ptrs2[0]" into a restricted pointer to
var?
If this case is legit, the correct place to match RESTRICT flags is
compare_cgraph_references. We can also go with your patch that will make A and
B considered to be different and thus prevent merging PTRS1&PTRS2.