https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78194
Bug ID: 78194 Summary: Failure to optimize squaring Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- int square(int x) { int result = 0; for (int i = 0; i < x; ++i) result += x; return result; } is not optimized into return x * x; while llvm can do that.