public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "paulthomas2 at wanadoo dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/18857] MATMUL failing with ALLOCATED matrices, unless base indices given
Date: Mon, 25 Apr 2005 20:31:00 -0000	[thread overview]
Message-ID: <20050425203115.22010.qmail@sourceware.org> (raw)
In-Reply-To: <20041206185831.18857.paulthomas2@wanadoo.fr>


------- Additional Comments From paulthomas2 at wanadoo dot fr  2005-04-25 20:31 -------
Subject: Re:  MATMUL failing with ALLOCATED matrices, unless base indices given

Tobi,

Does this do it for you? - it works with those assertions eliminated.

!{ dg-do run }
! Test MATMUL for various kinds of array.
! provided by Paul Thomas - pault@gcc.gnu.org

Program test_matmul
  integer, parameter                                :: N = 5
  integer, parameter                                :: T = 4
  real(kind=T), dimension(:,:), allocatable, Target :: a, b, c
  real(kind=T), dimension(:,:), POINTER             :: d, e
  real(kind=T), dimension(N,N)                      :: x, y, z

  allocate (a(2*N, N), b(N, N), c(2*N, N))
  a = 1.0_T
  a(1:N,:) = 2.0_T
  b = 4.0_T
  x = 1.0_T
  y = 2.0_T

  z = 0.0_T
  z = matmul (x, y)
  if (sum (z) /= 250.0_T) call abort ()

  c = 0.0_T
  c = matmul (a, b)
  if (sum (c) /= 1500.0_T) call abort ()

  c = 0.0_T
  d => a(1 : N, 1:N)
  c = matmul (d, b)
  if (sum (c) /= 1000.0_T) call abort ()

  c = 0.0_T
  d => a(N+1 : 2*N, 1:N)
  c = matmul (d, b)
  if (sum (c) /= 500.0_T) call abort ()

  c = 0.0_T
  e => c(N+1 : 2*N, 1 : N)
  e = matmul (d, b)
  if (sum (c(1 : N, 1 : N)) /= 0.0_T) call abort ()
  if (sum (c(N+1 : 2*N, 1 : N)) /= 500.0_T) call abort ()

  call doitagain (a ,b ,c ,x ,y ,z )

  deallocate (a, b, c)

contains

  subroutine doitagain (a ,b ,c ,x ,y ,z )
    real(kind=T), dimension(5:, 5:)    ::  a ,b ,c ,x ,y ,z

    z = 0.0_T
    z = matmul (x, y)
    if (sum (z) /= 250.0_T) call abort ()

    c = 0.0_T
    c = matmul (a, b)
    if (sum (c) /= 1500.0_T) call abort ()

  end subroutine doitagain

end program test_matmul




-- 


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


  parent reply	other threads:[~2005-04-25 20:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-06 18:58 [Bug libfortran/18857] New: " paulthomas2 at wanadoo dot fr
2004-12-06 21:29 ` [Bug libfortran/18857] " pinskia at gcc dot gnu dot org
2004-12-08 23:44 ` tobi at gcc dot gnu dot org
2005-04-19 18:51 ` [Bug fortran/18857] " tkoenig at gcc dot gnu dot org
2005-04-25 14:13 ` tobi at gcc dot gnu dot org
2005-04-25 15:35 ` paulthomas2 at wanadoo dot fr
2005-04-25 20:31 ` paulthomas2 at wanadoo dot fr [this message]
2005-04-25 20:47 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2005-04-26 12:56 ` paulthomas2 at wanadoo dot fr
2005-04-29  9:52 ` [Bug libfortran/18857] " paulthomas2 at wanadoo dot fr
2005-04-29 10:29 ` tobi at gcc dot gnu dot org
2005-04-29 14:59 ` paulthomas2 at wanadoo dot fr
2005-04-29 16:34 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2005-05-24 21:59 ` [Bug libfortran/18857] [4.0 only] " tkoenig at gcc dot gnu dot org
2005-07-08  1:37 ` mmitchel at gcc dot gnu dot org
2005-07-15 20:48 ` cvs-commit at gcc dot gnu dot org
2005-07-15 20:50 ` tkoenig at gcc dot gnu dot org
2005-07-15 20:50 ` tkoenig at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050425203115.22010.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).