public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/13105] New: array slice can return incorrect values and can have incorrect shape
@ 2003-11-18 12:57 melvin dot hadasht at free dot fr
  2003-11-18 13:00 ` [Bug fortran/13105] " melvin dot hadasht at free dot fr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: melvin dot hadasht at free dot fr @ 2003-11-18 12:57 UTC (permalink / raw)
  To: gcc-bugs

Using tree-ssa from 2003-11-15, on PII266, linux-2.6.0-test9-mm2, glibc-2.3.2

It looks like slices of arrays of rank 3 have a problem

(I did not do extensive tests on rank 2).


The following test case produces incorrect results:

cat > test_slice.f90 << EOF



program test_slice

  implicit none

  

  real (kind = 8), dimension(2, 2, 2) :: x

  real (kind = 8) :: min, max



  x = 1

  print *, 'x(1, 1:2, 1:1)):'

  min = minval(x(1, 1:2, 1:1)) ! may not give 1

  max = maxval(x(1, 1:2, 1:1)) ! may not give 1

  print *, min, max, ":", x(1, 1:2, 1:1) ! not all values are 1

  print *, "shape: ", shape(x(1, 1:2, 1:1)) ! returns 1 2 instead of 2 1



  print *, 'x(1, 1:2, 1)):'

  min = minval(x(1, 1:2, 1)) ! ok but...

  max = maxval(x(1, 1:2, 1)) ! ok but..

  print *, min, max, ":", x(1, 1:2, 1) ! ok but..

  print *, "shape: ", shape(x(1, 1:2, 1)) ! ..error: returns 1 instead of 2



  print *, 'x(1:1, 1:2, 1:1)):'

  min = minval(x(1:1, 1:2, 1:1))  ! ok

  max = maxval(x(1:1, 1:2, 1:1))  ! ok

  print *, min, max, ":",  x(1:1, 1:2, 1:1) ! ok

  print *, "shape:", shape(x(1:1, 1:2, 1:1)) ! ok



end program test_slice

EOF

Returns:
x(1, 1:2, 1:1)):

    1.00000000000000         2.08604192733644     :     2.08604192733644       
 1.00000000000000    

shape:             1            2                !!! should be 1 1 : 1 1 and 
shape should be 2 1

x(1, 1:2, 1)):

    1.00000000000000         1.00000000000000     :     1.00000000000000       
 1.00000000000000    

shape:             1                 !! should be 2

x(1:1, 1:2, 1:1)):

    1.00000000000000         1.00000000000000     :     1.00000000000000       
 1.00000000000000    

shape:            1            2            1 !! ok

Tested also against VAST-F90 and IFC to confirm expected results.

Fortran version:
/usr/local/gcc-ssa/bin/gfortran -v

Reading specs from
/usr/local/gcc-ssa/bin/../lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa/specs

Configured with: /usr/local/src/cvs/gcc/configure
--enable-languages=c,f95,f77,c++,objc --prefix=/usr/local/gcc-ssa :
(reconfigured) /usr/local/src/cvs/gcc/configure
--enable-languages=c,f95,c++,objc --prefix=/usr/local/gcc-ssa

Thread model: posix

gcc version 3.5-tree-ssa 20031115 (merged 20031111)

-- 
           Summary: array slice can return incorrect values and can have
                    incorrect shape
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: melvin dot hadasht at free dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2003-12-09 18:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-18 12:57 [Bug fortran/13105] New: array slice can return incorrect values and can have incorrect shape melvin dot hadasht at free dot fr
2003-11-18 13:00 ` [Bug fortran/13105] " melvin dot hadasht at free dot fr
2003-11-18 18:30 ` [Bug fortran/13105] [gfortran] " melvin dot hadasht at free dot fr
2003-11-23 23:40 ` pbrook at gcc dot gnu dot org
2003-11-23 23:42 ` pbrook at gcc dot gnu dot org
2003-11-24 13:52 ` cvs-commit at gcc dot gnu dot org
2003-11-24 14:08 ` pbrook at gcc dot gnu dot org
2003-12-09 18:42 ` dhazeghi at yahoo dot com

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).