https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70856
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org, | |mliska at suse dot cz --- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to vries from comment #5) > before icf, we have: > ... > static real(kind=4) A.4[2] = {1.0e+0, 2.0e+0}; > static real(kind=4) A.1[2] = {1.0e+0, 2.0e+0}; > ... > > Then icf does: > ... > Semantic equality hit:A.4->A.1 > Assembler symbol names:A.4.3435->A.1.3429 > Unified; Variable alias has been created. > ... > > And after icf, we have: > ... > static real(kind=4) A.4[2] = {1.0e+0, 2.0e+0}; > static real(kind=4) A.1[2]; > ... > > What openacc does, is run ipa-pta before and after icf. > > The compilation succeeds with -fno-ipa-icf. Hmm, indeed running ICF after IPA PTA invalidates points-to info (eventually even causing wrong-code). There is nothing ICF can do here (it would need to adjust all points-to bitmaps). Note that this is true also for non-IPA PTA info. The wrong-code possibilities (given that we only merge readonly decls in ICF) restrict themselves to equality/inequality compares which constitute an area in ICF that is fishy anyway. That said - if ICF would adjust DECL_PT_UID then a testcase like static const int a[] = { 1, 2, 3, 4 }; static const int b[] = { 1, 2, 3, 4 }; bool isA (int *p) { return p == a; } bool isB (int *p) { return p == b; } int main() { if (! (isA (a) || isB (a))) abort (); } could start to abort (it's a bit tricky and would involve some disabling of some CCP I guess). Honza, Martin - I suppose if we start to comare DECL_PT_UID in ICF then this effectively disables ICF of variables. Any ideas besides adjusting DECL_PT_UID in ICF and hoping for the best (on the wrong-code issue)?