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

* [Bug fortran/13105] array slice can return incorrect values and can have incorrect shape
  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 ` melvin dot hadasht at free dot fr
  2003-11-18 18:30 ` [Bug fortran/13105] [gfortran] " melvin dot hadasht at free dot fr
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: melvin dot hadasht at free dot fr @ 2003-11-18 13:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From melvin dot hadasht at free dot fr  2003-11-18 13:00 -------
Created an attachment (id=5160)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5160&action=view)
test case test_slice.f90

shows incorrect values and shapes in slices of rank 3 arrays. See comments for
expected values.

-- 


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


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

* [Bug fortran/13105] [gfortran] array slice can return incorrect values and can have incorrect shape
  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 ` melvin dot hadasht at free dot fr
  2003-11-23 23:40 ` pbrook at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: melvin dot hadasht at free dot fr @ 2003-11-18 18:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From melvin dot hadasht at free dot fr  2003-11-18 18:30 -------
Added [gfortran] to bug summary

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|array slice can return      |[gfortran] array slice can
                   |incorrect values and can    |return incorrect values and
                   |have incorrect shape        |can have incorrect shape


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


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

* [Bug fortran/13105] [gfortran] array slice can return incorrect values and can have incorrect shape
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pbrook at gcc dot gnu dot org @ 2003-11-23 23:40 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-23 23:40:48
               date|                            |


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


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

* [Bug fortran/13105] [gfortran] array slice can return incorrect values and can have incorrect shape
  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
                   ` (2 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pbrook at gcc dot gnu dot org @ 2003-11-23 23:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pbrook at gcc dot gnu dot org  2003-11-23 23:42 -------
Fix in progress. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pbrook at gcc dot gnu dot
                   |dot org                     |org


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


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

* [Bug fortran/13105] [gfortran] array slice can return incorrect values and can have incorrect shape
  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
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-11-24 13:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-11-24 13:52 -------
Subject: Bug 13105

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	tree-ssa-20020619-branch
Changes by:	pbrook@gcc.gnu.org	2003-11-24 13:52:35

Modified files:
	gcc/fortran    : ChangeLog array.c trans-array.c 
Added files:
	gcc/testsuite/gfortran.fortran-torture/execute: test_slice.f90 

Log message:
	PR fortran/13105
	* array.c (gfc_array_ref_shape): Handle elemental dimensions.
	* trans-array.c (gfc_trans_preloop_setup): Use correct dim lookup.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.76&r2=1.1.2.77
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/array.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.4&r2=1.1.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-array.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.9&r2=1.1.2.10
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.fortran-torture/execute/test_slice.f90.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug fortran/13105] [gfortran] array slice can return incorrect values and can have incorrect shape
  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
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: pbrook at gcc dot gnu dot org @ 2003-11-24 14:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pbrook at gcc dot gnu dot org  2003-11-24 14:08 -------
Fixed. 

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


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


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

* [Bug fortran/13105] [gfortran] array slice can return incorrect values and can have incorrect shape
  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
                   ` (5 preceding siblings ...)
  2003-11-24 14:08 ` pbrook at gcc dot gnu dot org
@ 2003-12-09 18:42 ` dhazeghi at yahoo dot com
  6 siblings, 0 replies; 8+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-12-09 18:42 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |tree-ssa


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