[Bug fortran/60392] Problem with TRANSPOSE and CONTIGUOUS dummy arguments

2015-05-16 Thread a.vogt at fulguritus dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60392

Alexander Vogt a.vogt at fulguritus dot com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #12 from Alexander Vogt a.vogt at fulguritus dot com ---
I don't think that is necessary... Thanks anyway!


[Bug fortran/60392] Problem with TRANSPOSE and CONTIGUOUS dummy arguments

2015-05-16 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60392

Thomas Koenig tkoenig at gcc dot gnu.org changed:

   What|Removed |Added

 CC||tkoenig at gcc dot gnu.org
  Known to work|4.10.0  |5.0

--- Comment #11 from Thomas Koenig tkoenig at gcc dot gnu.org ---
I don't think backporting to 4.8 is necessary any more.

Time to close?


[Bug fortran/60392] Problem with TRANSPOSE and CONTIGUOUS dummy arguments

2014-05-23 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60392

Dominique d'Humieres dominiq at lps dot ens.fr changed:

   What|Removed |Added

  Known to work||4.10.0, 4.9.0
  Known to fail||4.7.4, 4.8.3

--- Comment #10 from Dominique d'Humieres dominiq at lps dot ens.fr ---
 Fixed on trunk.

Any plan to back port the fix for 4.8.4? If needed I can do it.


[Bug fortran/60392] Problem with TRANSPOSE and CONTIGUOUS dummy arguments

2014-03-14 Thread mikael at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60392

--- Comment #7 from Mikael Morin mikael at gcc dot gnu.org ---
Author: mikael
Date: Fri Mar 14 21:28:59 2014
New Revision: 208581

URL: http://gcc.gnu.org/viewcvs?rev=208581root=gccview=rev
Log:
fortran/
PR fortran/60392
* trans-array.c (gfc_conv_array_parameter): Don't reuse the descriptor
if it has transposed dimensions.

testsuite/
PR fortran/60392
* gfortran.dg/transpose_4.f90: New test.


Added:
trunk/gcc/testsuite/gfortran.dg/transpose_4.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-array.c
trunk/gcc/testsuite/ChangeLog


[Bug fortran/60392] Problem with TRANSPOSE and CONTIGUOUS dummy arguments

2014-03-14 Thread mikael at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60392

--- Comment #8 from Mikael Morin mikael at gcc dot gnu.org ---
Fixed on trunk.


[Bug fortran/60392] Problem with TRANSPOSE and CONTIGUOUS dummy arguments

2014-03-14 Thread a.vogt at fulguritus dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60392

--- Comment #9 from Alexander Vogt a.vogt at fulguritus dot com ---
Thanks a lot!


[Bug fortran/60392] Problem with TRANSPOSE and CONTIGUOUS dummy arguments

2014-03-07 Thread mikael at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60392

--- Comment #5 from Mikael Morin mikael at gcc dot gnu.org ---
Created attachment 32307
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=32307action=edit
preliminary patch

This removes the difference between my_mul/my_mul_cont.
However this is not yet correct, with the patch the program output is:

 Normal:   0
   7  10  15  22
   7  10  15  22
 Transposed:   0
   5  11  11  25
   5  11  11  25

and according to maxima (so rather accurate):
  matmul(transpose(a), a) == matrix([10, 14], [14, 20])
and
  matrix([5, 11], [11, 25]) == matmul(a, transpose(a))

So there remains a wrong transposition hiding somewhere.


[Bug fortran/60392] Problem with TRANSPOSE and CONTIGUOUS dummy arguments

2014-03-07 Thread mikael at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60392

--- Comment #6 from Mikael Morin mikael at gcc dot gnu.org ---
(In reply to Mikael Morin from comment #5)
 This removes the difference between my_mul/my_mul_cont.
 However this is not yet correct, with the patch the program output is:
 
Maybe it's correct after all.
It's matter of matrix representation in memory.  I never have it right.


[Bug fortran/60392] Problem with TRANSPOSE and CONTIGUOUS dummy arguments

2014-03-05 Thread mikael at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60392

Mikael Morin mikael at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2014-03-05
 CC||mikael at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #3 from Mikael Morin mikael at gcc dot gnu.org ---
for both calls (my_mul and my_mul_cont) we create a descriptor for a (with
transposed bounds as expected) and make a call to internal_pack.
After that the calls start to differ.
The pointer returned by internal_pack is passed directly to my_mul.
In the case of my_mul_cont, we have to create a descriptor around the pointer
to pass as argument, and we reuse the one passed to internal_pack, but that one
has the bounds transposed! So we pass the transposed array with transposed
bounds - we pass the original array.


[Bug fortran/60392] Problem with TRANSPOSE and CONTIGUOUS dummy arguments

2014-03-05 Thread mikael at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60392

--- Comment #4 from Mikael Morin mikael at gcc dot gnu.org ---
(In reply to Mikael Morin from comment #3)
 So we pass the transposed array with
 transposed bounds - we pass the original array.

Not exactly in fact:
In my_mul_cont, a.stride[0] == 2 and a.stride[1] == 1.
But a descriptor is created for the matmul call, and that one resets
a.stride[0] to 1, so the descriptor passed to matmul has a.stride[0] == 1 and
a.stride[1] == 1.


[Bug fortran/60392] Problem with TRANSPOSE and CONTIGUOUS dummy arguments

2014-03-03 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60392

janus at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||wrong-code
 CC||janus at gcc dot gnu.org

--- Comment #2 from janus at gcc dot gnu.org ---
Confirmed with 4.6 to trunk.

Somewhat modified test case (using integers, 2x2 matrices, functions; without
random numbers):


program test
  implicit none

  integer, dimension(2,2), parameter :: A = reshape ((/1,2,3,4/), (/2,2/))
  integer, dimension(2,2) :: B1, B2

  ! Normal argument
  B1 = my_mul(A,A)
  B2 = my_mul_cont(A,A)
  print *,'Normal:',maxval(abs(B1-B2))
  print *,B1
  print *,B2

  ! Transposed argument
  B1 = my_mul(transpose(A),A)
  B2 = my_mul_cont(transpose(A),A)
  print *,'Transposed:',maxval(abs(B1-B2))
  print *,B1
  print *,B2

contains

  function my_mul(A,C) result (B)
use, intrinsic :: ISO_Fortran_env
integer, intent(in) :: A(2,2), C(2,2)
integer :: B(2,2)
B = matmul(A, C)
  end function

  function my_mul_cont(A,C) result (B)
use, intrinsic :: ISO_Fortran_env
integer, intent(in), contiguous :: A(:,:), C(:,:)
integer :: B(2,2)
B = matmul(A, C)
  end function

end program


[Bug fortran/60392] Problem with TRANSPOSE and CONTIGUOUS dummy arguments

2014-03-02 Thread a.vogt at fulguritus dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60392

--- Comment #1 from Alexander Vogt a.vogt at fulguritus dot com ---
Created attachment 32243
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=32243action=edit
Sample code