https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63569
Bug ID: 63569 Summary: [5.0 Regression] Wrong code with volatile and ICF Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Take: static int f(int t, int *a) __attribute__((noinline)); static int g(int t, volatile int *a) __attribute__((noinline)); static int g(int t, volatile int *a) { int i; int tt = 0; for(i=0;i<t;i++) tt += *a; return tt; } static int f(int t, int *a) { int i; int tt = 0; for(i=0;i<t;i++) tt += *a; return tt; } int h(int t, int *a) { return f(t, a) + g(t, a); } --- CUT --- The order of f and g are important. The .icf dump has: Semantic equality hit:f->g Assembler symbol names:f->g Which is incorrect as they are not semantic equivalent as one you can load from a only once while the other you need to load a each time through the loop.