Created attachment 30997 [details] Two .cpp source code It seems newer versions of gcc (4.8+) don't pre-calculate functions for constant inputs (Asked the issue here: http://stackoverflow.com/q/19350097/952747). Two source codes attached. unsigned long long s(unsigned long long n) { auto s = 0ULL; for (auto i = 0ULL; i < n; i++) s += i; return s; } const auto N = 1000000000ULL; auto x = s(N); // It computes in run-time and dose NOT compute in compile-time!
Comment on attachment 30997 [details] Two .cpp source code Tests are made in MinGW/32bit.
This optimization is still available in 4.7.2. The issue is present on Linux 64 bit, 4.8.1 also. http://coliru.stacked-crooked.com/a/9c22ce6c4b6f1a94
sccp pass used to optimize: unsigned long long foo () { unsigned long long s = 0, i; for (i = 0; i < 1000000000ULL; i++) s += i; return s; } before r194578, but no longer does in 4.8. In 4.9 this got fixed again, trying to bisect now.
Ah, fixed by r202168. *** This bug has been marked as a duplicate of bug 57511 ***