public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dick dot hendrickson at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/35681]  New: wrong result for vector subscripted array expression in MVBITS
Date: Mon, 24 Mar 2008 19:40:00 -0000	[thread overview]
Message-ID: <bug-35681-15620@http.gcc.gnu.org/bugzilla/> (raw)

The following program prints out the wrong results when an
array with vector valued subscript is used in an expression
as the FROM argument and also used as the TO argument.
The array case gives different results from a similar
scalar DO loop.

If a different array is used in the FROM argument, the array
results are the same as the scalar results.

I'd guess that you aren't recognizing
(ILA1(NFV3))
as an expression and copying it to a temp before invoking
MVBITS.

Dick Hendrickson


      program YA0017

! gcc version 4.4.0 20080312 (experimental) [trunk revision 133139] (GCC)

      INTEGER ILA1(10)
      INTEGER ILA2(10)
      INTEGER ICA3(10), nfv3(10)
      ILA1 = (/1,2,3,4,5,6,7,8,9,10/)
      ILA2 = (/1,2,3,4,5,6,7,8,9,10/)
      ica3 = (/1,2,3,4,5,6,7,8,9,10/)
      nfv3 = (/9,9,6,2,4,9,2,9,6,10/)

      DO J1 = 1,10
        CALL MVBITS(Ila1(NFV3(J1)),2,4,ILA2(J1), 3)
      ENDDO

      CALL MVBITS ((ILA1(NFV3)), 2, 4, ILA1, 3)       !fails

      print *, 'first test'
      DO J1 = 1,10
      IF (ILA1(J1) .NE. ILA2(J1))
     $ print *, 'j1 = ', j1, '  vvs = ', nfv3(j1),
     $ '  scalar =', ila2(j1), '  vector = ', ila1(j1)
      ENDDO


      ILA1 = (/1,2,3,4,5,6,7,8,9,10/)
      ILA2 = (/1,2,3,4,5,6,7,8,9,10/)
      ica3 = (/1,2,3,4,5,6,7,8,9,10/)
      nfv3 = (/9,9,6,2,4,9,2,9,6,10/)

      DO J1 = 1,10
        CALL MVBITS(Ica3(NFV3(J1)),2,4,ILA2(J1), 3)
      ENDDO

      CALL MVBITS ((Ica3(NFV3)), 2, 4, ILA1, 3)      !works

      print *, 'second test'
      DO J1 = 1,10
      IF (ILA1(J1) .NE. ILA2(J1))
     $ print *, 'j1 = ', j1, '  vvs = ', nfv3(j1),
     $ '  scalar =', ila2(j1), '  vector = ', ila1(j1)
      ENDDO
      END 


-------------------------------------------------------
results
C:\g_experiments\gfortran>gfortran ya0017.f
C:\g_experiments\gfortran>a
 first test
 j1 =            4   vvs =            2   scalar =           4   vector =
    36
 j1 =            5   vvs =            4   scalar =          13   vector =
    77
 j1 =            7   vvs =            2   scalar =           7   vector =
    39
 j1 =            9   vvs =            6   scalar =           9   vector =
    41
 second test


-- 
           Summary: wrong result for vector subscripted array expression in
                    MVBITS
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dick dot hendrickson at gmail dot com


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


             reply	other threads:[~2008-03-24 19:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-24 19:40 dick dot hendrickson at gmail dot com [this message]
2008-03-24 22:13 ` [Bug fortran/35681] " burnus at gcc dot gnu dot org
2008-03-28 15:19 ` fxcoudert at gcc dot gnu dot org
2008-03-28 15:29 ` dominiq at lps dot ens dot fr
2008-03-28 15:49 ` dick dot hendrickson at gmail dot com
2008-03-28 16:22 ` dominiq at lps dot ens dot fr
2008-10-14 16:22 ` domob at gcc dot gnu dot org
2008-10-16 16:33 ` domob at gcc dot gnu dot org
2008-10-18  8:28 ` domob at gcc dot gnu dot org
2008-10-18  9:32 ` dominiq at lps dot ens dot fr
2008-10-18 10:22 ` burnus at gcc dot gnu dot org
2008-10-18 11:37 ` burnus at gcc dot gnu dot org
2008-10-18 17:03 ` dick dot hendrickson at gmail dot com
2008-10-19 14:35 ` pault at gcc dot gnu dot org
2008-10-19 14:48 ` domob at gcc dot gnu dot org
2008-10-19 16:17 ` domob at gcc dot gnu dot org
2008-11-01 13:29 ` domob at gcc dot gnu dot org
2008-11-01 13:38 ` domob at gcc dot gnu dot org
2008-11-13 17:18 ` domob at gcc dot gnu dot org
2008-11-14 13:03 ` mikael at gcc dot gnu dot org
2008-11-16 22:47 ` mikael at gcc dot gnu dot org
2008-11-23 19:09 ` burnus at gcc dot gnu dot org
2008-11-24 12:16 ` mikael at gcc dot gnu dot org
2008-11-24 12:27 ` mikael at gcc dot gnu dot org
2008-11-24 12:40 ` mikael at gcc dot gnu dot org
2008-11-24 12:49 ` mikael at gcc dot gnu dot org
2008-11-24 13:11 ` mikael at gcc dot gnu dot org
2008-11-24 19:16 ` pault at gcc dot gnu dot org
2009-01-04 19:12 ` mikael at gcc dot gnu dot org
2009-01-14 20:53 ` mikael at gcc dot gnu dot org
2009-01-29 17:35 ` hjl dot tools at gmail dot com

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=bug-35681-15620@http.gcc.gnu.org/bugzilla/ \
    --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).