https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111430
Bug ID: 111430 Summary: IPA read only variable analysis should handle the case where the storing was the same as the initialization Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org CC: marxin at gcc dot gnu.org Target Milestone: --- Take: ``` #define CST 1025 static int b = CST; void f(int a) { if (a) b = CST; } int g(void) { return b; } ``` We should be able to optimize out the store to b in f and even the load in g. This is another way of solving the original testcase in PR 110992.