public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/42479]  New: Wrong-code  for induct.f90 with " -O3 -floop-block"
@ 2009-12-23 13:54 dominiq at lps dot ens dot fr
  2010-01-05 11:41 ` [Bug middle-end/42479] Wrong code with -floop-block fxcoudert at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2009-12-23 13:54 UTC (permalink / raw)
  To: gcc-bugs

At revision 155425 the executable  for induct.f90 compiled with " -O3
-floop-block" gives:

...
 Maximum wand/quad abs rel mutual inductance =   1.84138324899744549E-002
...

instead of 

...
 Maximum wand/quad abs rel mutual inductance =   5.95379428444659381E-002
...

when compiled with "-O2 -floop-block".

Note that the wrong code runs in ~8.5s, while the fastest right code runs in
~14s.


-- 
           Summary: Wrong-code  for induct.f90 with " -O3 -floop-block"
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dominiq at lps dot ens dot fr
 GCC build triplet: x86_64-apple-darwin10
  GCC host triplet: x86_64-apple-darwin10
GCC target triplet: x86_64-apple-darwin10


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


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

* [Bug middle-end/42479] Wrong code with -floop-block
  2009-12-23 13:54 [Bug middle-end/42479] New: Wrong-code for induct.f90 with " -O3 -floop-block" dominiq at lps dot ens dot fr
@ 2010-01-05 11:41 ` fxcoudert at gcc dot gnu dot org
  2010-01-05 11:42 ` fxcoudert at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2010-01-05 11:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2010-01-05 11:40 -------
Also happens at rev. 155544 on x86_64-unknown-linux-gnu, with both -m32 and
-m64. "-O3 -floop-block" gives different results than "-O3" alone (and is much
faster). Profiling should indicate what part of code is different (I tried
diff'ing the optimized tree dumps, but it's too hard with the variable name
changes).


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|x86_64-apple-darwin10       |
   GCC host triplet|x86_64-apple-darwin10       |
 GCC target triplet|x86_64-apple-darwin10       |i386, x86_64
   Last reconfirmed|0000-00-00 00:00:00         |2010-01-05 11:40:52
               date|                            |
            Summary|Wrong-code  for induct.f90  |Wrong code with -floop-block
                   |with " -O3 -floop-block"    |


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


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

* [Bug middle-end/42479] Wrong code with -floop-block
  2009-12-23 13:54 [Bug middle-end/42479] New: Wrong-code for induct.f90 with " -O3 -floop-block" dominiq at lps dot ens dot fr
  2010-01-05 11:41 ` [Bug middle-end/42479] Wrong code with -floop-block fxcoudert at gcc dot gnu dot org
@ 2010-01-05 11:42 ` fxcoudert at gcc dot gnu dot org
  2010-01-05 12:56 ` dominiq at lps dot ens dot fr
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2010-01-05 11:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from fxcoudert at gcc dot gnu dot org  2010-01-05 11:42 -------
Created an attachment (id=19471)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19471&action=view)
Source file and input file

Compile induct.f90 and run with induct.in in the same directory.


-- 


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


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

* [Bug middle-end/42479] Wrong code with -floop-block
  2009-12-23 13:54 [Bug middle-end/42479] New: Wrong-code for induct.f90 with " -O3 -floop-block" dominiq at lps dot ens dot fr
  2010-01-05 11:41 ` [Bug middle-end/42479] Wrong code with -floop-block fxcoudert at gcc dot gnu dot org
  2010-01-05 11:42 ` fxcoudert at gcc dot gnu dot org
@ 2010-01-05 12:56 ` dominiq at lps dot ens dot fr
  2010-01-05 14:35 ` dominiq at lps dot ens dot fr
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-01-05 12:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dominiq at lps dot ens dot fr  2010-01-05 12:56 -------
Profiling without -floop-block

+ 99.8%, start, a.out
| + 99.8%, main, a.out
| | + 99.8%, induct_, a.out
| | | + 77.5%, __mqc_m_MOD_mutual_ind_quad_cir_coil, a.out
| | | |   2.8%, cosisin, libSystem.B.dylib
| | | | - 1.0%, cexp$fenv_access_off, libSystem.B.dylib
| | | | - 0.2%, asin, libSystem.B.dylib
| | | |   0.1%, cos$fenv_access_off, libSystem.B.dylib
| | | |   0.1%, _gfortran_transpose_r8, libgfortran.3.dylib
| | | |   0.0%, dyld_stub_cexp, a.out
| | | |   0.0%, dyld_stub_asin, a.out
| | | |   0.0%, dyld_stub__gfortran_transpose_r8, a.out
| | | - 21.9%, __mqr_m_MOD_mutual_ind_quad_rec_coil, a.out
| | | - 0.1%, __s_rect_m_MOD_rect_self_inductance, a.out
| | | - 0.1%, __rect_r_m_MOD_rect_resistance, a.out
| | |   0.0%, log, libSystem.B.dylib
| | | - 0.0%, __gen_resq_mesh_m_MOD_gen_resq_mesh, a.out
| | | - 0.0%, __mcr_m_MOD_mutual_ind_cir_rec_coils, a.out
| | | - 0.0%, free_large, libSystem.B.dylib
| | |   0.0%, cos$fenv_access_off, libSystem.B.dylib
| | | - 0.0%, __mcc_m_MOD_mutual_ind_cir_cir_coils, a.out
| | | - 0.0%, __define_wand_coils_m_MOD_define_wand_coils, a.out
| | | - 0.0%, __computer_time_m_MOD_computer_time, a.out

with -floop-block

+ 99.6%, start, a.out
| + 99.6%, main, a.out
| | + 99.6%, induct_, a.out
| | | + 59.1%, __mqr_m_MOD_mutual_ind_quad_rec_coil, a.out
| | | | + 0.1%, asin, libSystem.B.dylib
| | | | |   0.0%, sqrtl, libSystem.B.dylib
| | | |   0.1%, _gfortran_transpose_r8, libgfortran.3.dylib
| | | |   0.1%, cos$fenv_access_off, libSystem.B.dylib
| | | |   0.0%, dyld_stub_cos, a.out
| | | - 39.4%, __mqc_m_MOD_mutual_ind_quad_cir_coil, a.out
| | | - 0.4%, __s_rect_m_MOD_rect_self_inductance, a.out
| | | - 0.3%, __rect_r_m_MOD_rect_resistance, a.out
| | |   0.1%, log, libSystem.B.dylib
| | | - 0.1%, __gen_resq_mesh_m_MOD_gen_resq_mesh, a.out
| | |   0.0%, __mcr_m_MOD_mutual_ind_cir_rec_coils, a.out
| | | - 0.0%, free_large, libSystem.B.dylib
| | |   0.0%, asin, libSystem.B.dylib
| | |   0.0%, __mcc_m_MOD_mutual_ind_cir_cir_coils, a.out
| | | - 0.0%, __gen_resq_mesh_m_MOD_gen_resq_mesh_size, a.out
| | | - 0.0%, __define_wand_coils_m_MOD_define_wand_coils, a.out
| |   0.0%, __mqc_m_MOD_mutual_ind_quad_cir_coil, a.out

The miscompiled subroutine being mutual_ind_quad_rec_coil.


-- 


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


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

* [Bug middle-end/42479] Wrong code with -floop-block
  2009-12-23 13:54 [Bug middle-end/42479] New: Wrong-code for induct.f90 with " -O3 -floop-block" dominiq at lps dot ens dot fr
                   ` (2 preceding siblings ...)
  2010-01-05 12:56 ` dominiq at lps dot ens dot fr
@ 2010-01-05 14:35 ` dominiq at lps dot ens dot fr
  2010-01-06 19:20 ` dominiq at lps dot ens dot fr
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-01-05 14:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dominiq at lps dot ens dot fr  2010-01-05 14:35 -------
Note that the inner loops in subroutine mutual_ind_quad_rec_coil are not
vectorized at -O3, unless -ffast-math is used. Timing the code with and without
-ffast-math gives

[macbook] lin/test% gfc -O3 induct.f90
[macbook] lin/test% time a.out > /dev/null
23.048u 0.037s 0:23.09 99.9%    0+0k 0+0io 0pf+0w
[macbook] lin/test% gfc -O3 -ffast-math induct.f90
[macbook] lin/test% time a.out > /dev/null
13.747u 0.033s 0:13.78 99.9%    0+0k 0+0io 0pf+0w
[macbook] lin/test% gfc -O3 -floop-block induct.f90
[macbook] lin/test% time a.out > /dev/null
8.452u 0.028s 0:08.48 99.8%     0+0k 0+0io 0pf+0w
[macbook] lin/test% gfc -O3 -ffast-math -floop-block induct.f90
[macbook] lin/test% time a.out > /dev/null
8.154u 0.030s 0:08.18 100.0%    0+0k 0+0io 0pf+0w


-- 


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


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

* [Bug middle-end/42479] Wrong code with -floop-block
  2009-12-23 13:54 [Bug middle-end/42479] New: Wrong-code for induct.f90 with " -O3 -floop-block" dominiq at lps dot ens dot fr
                   ` (3 preceding siblings ...)
  2010-01-05 14:35 ` dominiq at lps dot ens dot fr
@ 2010-01-06 19:20 ` dominiq at lps dot ens dot fr
  2010-01-07 22:36 ` [Bug middle-end/42479] [graphite] " spop at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-01-06 19:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dominiq at lps dot ens dot fr  2010-01-06 19:20 -------
"-O3 -floop-interchange -ftree-loop-distribution" gives also a wrong code. This
pr could be a duplicate of pr42637.


-- 


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


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

* [Bug middle-end/42479] [graphite] Wrong code with -floop-block
  2009-12-23 13:54 [Bug middle-end/42479] New: Wrong-code for induct.f90 with " -O3 -floop-block" dominiq at lps dot ens dot fr
                   ` (4 preceding siblings ...)
  2010-01-06 19:20 ` dominiq at lps dot ens dot fr
@ 2010-01-07 22:36 ` spop at gcc dot gnu dot org
  2010-01-14  8:41 ` spop at gcc dot gnu dot org
  2010-02-06 16:33 ` spop at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-01-07 22:36 UTC (permalink / raw)
  To: gcc-bugs



-- 

spop at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug middle-end/42479] [graphite] Wrong code with -floop-block
  2009-12-23 13:54 [Bug middle-end/42479] New: Wrong-code for induct.f90 with " -O3 -floop-block" dominiq at lps dot ens dot fr
                   ` (5 preceding siblings ...)
  2010-01-07 22:36 ` [Bug middle-end/42479] [graphite] " spop at gcc dot gnu dot org
@ 2010-01-14  8:41 ` spop at gcc dot gnu dot org
  2010-02-06 16:33 ` spop at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-01-14  8:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from spop at gcc dot gnu dot org  2010-01-14 08:41 -------
Mine.


-- 

spop at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |spop at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-01-05 11:40:52         |2010-01-14 08:41:17
               date|                            |


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


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

* [Bug middle-end/42479] [graphite] Wrong code with -floop-block
  2009-12-23 13:54 [Bug middle-end/42479] New: Wrong-code for induct.f90 with " -O3 -floop-block" dominiq at lps dot ens dot fr
                   ` (6 preceding siblings ...)
  2010-01-14  8:41 ` spop at gcc dot gnu dot org
@ 2010-02-06 16:33 ` spop at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-02-06 16:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from spop at gcc dot gnu dot org  2010-02-06 16:33 -------
This problem is fixed by the patch for PR42637 installed in the Graphite
branch.

*** This bug has been marked as a duplicate of 42637 ***


-- 

spop at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2010-02-06 16:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-23 13:54 [Bug middle-end/42479] New: Wrong-code for induct.f90 with " -O3 -floop-block" dominiq at lps dot ens dot fr
2010-01-05 11:41 ` [Bug middle-end/42479] Wrong code with -floop-block fxcoudert at gcc dot gnu dot org
2010-01-05 11:42 ` fxcoudert at gcc dot gnu dot org
2010-01-05 12:56 ` dominiq at lps dot ens dot fr
2010-01-05 14:35 ` dominiq at lps dot ens dot fr
2010-01-06 19:20 ` dominiq at lps dot ens dot fr
2010-01-07 22:36 ` [Bug middle-end/42479] [graphite] " spop at gcc dot gnu dot org
2010-01-14  8:41 ` spop at gcc dot gnu dot org
2010-02-06 16:33 ` spop at gcc dot gnu dot 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).