public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47153] New: g++ with -O3 enters infinite loop
@ 2011-01-02 19:39 panagopoulosalexandrou at hotmail dot com
  2011-01-02 20:44 ` [Bug c++/47153] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: panagopoulosalexandrou at hotmail dot com @ 2011-01-02 19:39 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: panagopoulosalexandrou@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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/47153] g++ with -O3 enters infinite loop
  2011-01-02 19:39 [Bug c++/47153] New: g++ with -O3 enters infinite loop panagopoulosalexandrou at hotmail dot com
@ 2011-01-02 20:44 ` redi at gcc dot gnu.org
  2011-01-02 20:45 ` zsojka at seznam dot cz
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2011-01-02 20:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47153

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011.01.02 20:44:28
     Ever Confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-01-02 20:44:28 UTC ---

(In reply to comment #0)
> Created attachment 22882 [details]
> The program for which the bug applies.

Apparently not:

$ ./a.out 
Usage: ./a.out <sudoku puzzle> or -f <sudoku file>
Show unknown boxes with . or 0

Please provide a reproducible testcase.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/47153] g++ with -O3 enters infinite loop
  2011-01-02 19:39 [Bug c++/47153] New: g++ with -O3 enters infinite loop panagopoulosalexandrou at hotmail dot com
  2011-01-02 20:44 ` [Bug c++/47153] " redi at gcc dot gnu.org
@ 2011-01-02 20:45 ` zsojka at seznam dot cz
  2011-01-03  1:52 ` panagopoulosalexandrou at hotmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2011-01-02 20:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47153

Zdenek Sojka <zsojka at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zsojka at seznam dot cz

--- Comment #2 from Zdenek Sojka <zsojka at seznam dot cz> 2011-01-02 20:45:50 UTC ---
Please upload minimal testcase that reproduces the problem.
I am not able to reproduce the problem by the steps you provided:

$ x86_64-pc-linux-gnu-g++-4.5.2 sudoku_solver_single.cpp -O3 -o
sudoku_solver_single
$ ./sudoku_solver_single 
Usage: ./sudoku_solver_single <sudoku puzzle> or -f <sudoku file>
Show unknown boxes with . or 0

However, if found_one is true, the loop is expected to never finish:
  } while(found_one);
maybe missing "!" ?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/47153] g++ with -O3 enters infinite loop
  2011-01-02 19:39 [Bug c++/47153] New: g++ with -O3 enters infinite loop panagopoulosalexandrou at hotmail dot com
  2011-01-02 20:44 ` [Bug c++/47153] " redi at gcc dot gnu.org
  2011-01-02 20:45 ` zsojka at seznam dot cz
@ 2011-01-03  1:52 ` panagopoulosalexandrou at hotmail dot com
  2011-01-03  2:17 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: panagopoulosalexandrou at hotmail dot com @ 2011-01-03  1:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47153

--- Comment #3 from panagopoulosalexandrou at hotmail dot com 2011-01-03 01:52:09 UTC ---
Sorry, forget about the found_one thing. Maybe the prompt is confusing; the
.923.........8.1...........1.7.4...........658.........6.5.2...4.....7.....9.....
is actually an argument to the program, not its output. Apparently, it didn't
fit on a single line that's why it's printed underneath the execution of the
program.
$ ./sudoku_solver_single .923..,etc.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/47153] g++ with -O3 enters infinite loop
  2011-01-02 19:39 [Bug c++/47153] New: g++ with -O3 enters infinite loop panagopoulosalexandrou at hotmail dot com
                   ` (2 preceding siblings ...)
  2011-01-03  1:52 ` panagopoulosalexandrou at hotmail dot com
@ 2011-01-03  2:17 ` redi at gcc dot gnu.org
  2011-01-03  2:36 ` zsojka at seznam dot cz
  2011-01-03  8:41 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2011-01-03  2:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47153

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
      Known to work|                            |4.1.2, 4.2.4, 4.3.4
      Known to fail|                            |4.4.5, 4.5.2, 4.6.0

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-01-03 02:17:18 UTC ---
thanks for clarifying - I can reproduce it at -O3 with g++ 4.4 and later


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/47153] g++ with -O3 enters infinite loop
  2011-01-02 19:39 [Bug c++/47153] New: g++ with -O3 enters infinite loop panagopoulosalexandrou at hotmail dot com
                   ` (3 preceding siblings ...)
  2011-01-03  2:17 ` redi at gcc dot gnu.org
@ 2011-01-03  2:36 ` zsojka at seznam dot cz
  2011-01-03  8:41 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2011-01-03  2:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47153

--- Comment #5 from Zdenek Sojka <zsojka at seznam dot cz> 2011-01-03 02:36:27 UTC ---
You are accessing an array out of bounds:

--- sudoku_solver_single.cpp    2011-01-03 03:30:35.000000000 +0100
+++ sudoku_solver_single2.cpp   2011-01-03 03:33:28.000000000 +0100
@@ -159,6 +159,7 @@
       for(x = left_box; x < left_box + 3; x++)
        for(y = up_box; y < up_box + 3; y++) {
          if(solved[x][y]) {
+           if (!resolve(x, y)) __builtin_abort();
            status[resolve(x, y) - 1] = 2;
            continue;
          }

aborts


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/47153] g++ with -O3 enters infinite loop
  2011-01-02 19:39 [Bug c++/47153] New: g++ with -O3 enters infinite loop panagopoulosalexandrou at hotmail dot com
                   ` (4 preceding siblings ...)
  2011-01-03  2:36 ` zsojka at seznam dot cz
@ 2011-01-03  8:41 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-03  8:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47153

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|                            |INVALID

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-03 08:41:00 UTC ---
Thus invalid.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-03  8:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-02 19:39 [Bug c++/47153] New: g++ with -O3 enters infinite loop panagopoulosalexandrou at hotmail dot com
2011-01-02 20:44 ` [Bug c++/47153] " redi at gcc dot gnu.org
2011-01-02 20:45 ` zsojka at seznam dot cz
2011-01-03  1:52 ` panagopoulosalexandrou at hotmail dot com
2011-01-03  2:17 ` redi at gcc dot gnu.org
2011-01-03  2:36 ` zsojka at seznam dot cz
2011-01-03  8:41 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).