Compiler Explorer - C++ (x86-64 clang (assertions trunk))

int sum(int n) { int res = 0; for (int i = 1; i <= n; ++i) res += i; return res; }