touch-packages team mailing list archive
-
touch-packages team
-
Mailing list archive
-
Message #90726
[Bug 1432250] [NEW] [4.7 Regression] Wrong optimization with -O2
You have been subscribed to a public bug:
As reported by Mike Mirzayanov on GCC Bugzilla:
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60766 and http://codeforces.com/blog/entry/11450
Ubuntu 14.04 includes GCC 4.8.2 which is affected with bug.
Please upgrade to GCC 4.8.3 or later in which the bug is fixed.
"
Compile with -O2 and input 9
Compile the following code with -O2:
~~~~~
#include <cstdlib>
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
int n;
cin >> n;
for (int x = 0; x <= n; x++) {
if (n == x + (x + 1) + (x + 2)) {
cout << x + 2 << " " << x + 1 << " " << x << endl;
exit(0);
}
}
cout << -1 << endl;
return 0;
}
~~~~~
Start binary and enter 9
It will print "-1", but expected output is "4 3 2".
"
** Affects: gcc-4.8 (Ubuntu)
Importance: Undecided
Status: New
--
[4.7 Regression] Wrong optimization with -O2
https://bugs.launchpad.net/bugs/1432250
You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to gcc-4.8 in Ubuntu.