this is fixed in trusty-updates ** Changed in: gcc-4.8 (Ubuntu) Status: New => Fix Released
-- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to gcc-4.8 in Ubuntu. https://bugs.launchpad.net/bugs/1432250 Title: [4.7 Regression] Wrong optimization with -O2 Status in gcc-4.8 package in Ubuntu: Fix Released Bug description: 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". " To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1432250/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp