http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47153
Summary: g++ with -O3 enters infinite loop Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: panagopoulosalexand...@hotmail.com Created attachment 22882 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22882 The program for which the bug applies. $ x86_64-redhat-linux-g++ sudoku_solver_single.cpp -O3 -o sudoku_solver_single $ ./sudoku_solver_single .923.........8.1...........1.7.4...........658.........6.5.2...4.....7.....9..... The program seems to enter an infinite loop inside solve, even though found_one is set to true. The expected behaviour is observed when -O2 is used instead.