public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/28923]  New: Bad triplet interpretation in initialization
@ 2006-09-01  8:58 dominiq at lps dot ens dot fr
  2006-09-05 19:41 ` [Bug fortran/28923] " pault at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dominiq at lps dot ens dot fr @ 2006-09-01  8:58 UTC (permalink / raw)
  To: gcc-bugs

The following program:

real, dimension(3,3), parameter :: a=reshape ((/(i, i = 1,9)/),(/3,3/))
real, dimension(2,3) :: b=a(:2:-1,:)
real, dimension(2,3) :: c=a(3:2:-1,:)
print *, b
print *, c
end

compiles with gfortran and gives:

   3.000000       2.000000       6.000000       5.000000       9.000000      
8.000000    
   3.000000       2.000000       6.000000       5.000000       9.000000      
8.000000    

i.e., b=a(:2:-1,:) is interpreted as c=a(3:2:-1,:) instead of giving:

real, dimension(2,3) :: b=a(:2:-1,:)
                          1
Error: Array assignment at (1) has different sizes (6/0)

as required by the following first and last paragraphs (draft f2003):

> 6.2.2.3.1 Subscript triplet
> 
> A subscript triplet designates a regular sequence of subscripts
> consisting of zero or more subscript values.  The third expression in the
> subscript triplet is the increment between the subscript values and is
> called the stride.  The subscripts and stride of a subscript triplet are
> optional.  An omitted first subscript in a subscript triplet is
> equivalent to a subscript whose value is the lower bound for the array
> and an omitted second subscript is equivalent to the upper bound.  An
> omitted stride is equivalent to a stride of 1.
> 
> The stride shall not be zero.
> 
> When the stride is positive, the subscripts specified by a triplet form a
> regularly spaced sequence of integers beginning with the first subscript
> and proceeding in increments of the stride to the largest such integer
> not greater than the second subscript; the sequence is empty if the first
> subscript is greater than the second.  
> 
> ...
> 
> When the stride is negative, the sequence begins with the first subscript
> and proceeds in increments of the stride down to the smallest such
> integer equal to or greater than the second subscript; the sequence is
> empty if the second subscript is greater than the first.

Note that:

real, dimension(3,3) :: a
real, dimension(2,3) :: b
a=1
b=a(:2:-1,:)
print *, b
end

gives correctly:

b=a(:2:-1,:)
1
Error: different shape for Array assignment at (1) on dimension 1 (2/0)

Dominique


-- 
           Summary: Bad triplet interpretation in initialization
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dominiq at lps dot ens dot fr
 GCC build triplet: gcc version 4.2.0 20060826 (experimental)
GCC target triplet: powerpc-apple-darwin7


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


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

* [Bug fortran/28923] Bad triplet interpretation in initialization
  2006-09-01  8:58 [Bug fortran/28923] New: Bad triplet interpretation in initialization dominiq at lps dot ens dot fr
@ 2006-09-05 19:41 ` pault at gcc dot gnu dot org
  2006-09-09 12:36 ` patchapp at dberlin dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-09-05 19:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pault at gcc dot gnu dot org  2006-09-05 19:41 -------
I had better deal with this, since I am teh author of the wrong bit of logic.

Thanks

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-09-05 19:41:52
               date|                            |


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


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

* [Bug fortran/28923] Bad triplet interpretation in initialization
  2006-09-01  8:58 [Bug fortran/28923] New: Bad triplet interpretation in initialization dominiq at lps dot ens dot fr
  2006-09-05 19:41 ` [Bug fortran/28923] " pault at gcc dot gnu dot org
@ 2006-09-09 12:36 ` patchapp at dberlin dot org
  2006-09-10 17:13 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: patchapp at dberlin dot org @ 2006-09-09 12:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from patchapp at dberlin dot org  2006-09-09 12:35 -------
Subject: Bug number PR28923

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-09/msg00341.html


-- 


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


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

* [Bug fortran/28923] Bad triplet interpretation in initialization
  2006-09-01  8:58 [Bug fortran/28923] New: Bad triplet interpretation in initialization dominiq at lps dot ens dot fr
  2006-09-05 19:41 ` [Bug fortran/28923] " pault at gcc dot gnu dot org
  2006-09-09 12:36 ` patchapp at dberlin dot org
@ 2006-09-10 17:13 ` pault at gcc dot gnu dot org
  2006-09-10 17:32 ` pault at gcc dot gnu dot org
  2006-09-10 19:44 ` pault at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-09-10 17:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2006-09-10 17:13 -------
Subject: Bug 28923

Author: pault
Date: Sun Sep 10 17:13:29 2006
New Revision: 116815

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116815
Log:
2006-09-10  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/28923
        expr.c (find_array_section): Only use the array lower and upper
        bounds for the start and end of the sections, where the expr is
        NULL.

2006-09-10  Paul Thomas  <pault@gcc.gnu.org>

        PR libfortran/28923
        gfortran.dg/array_initializer_2.f90: Fill in missing index start value.
        gfortran.dg/array_initializer_3.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/array_initializer_3.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/array_initializer_2.f90


-- 


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


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

* [Bug fortran/28923] Bad triplet interpretation in initialization
  2006-09-01  8:58 [Bug fortran/28923] New: Bad triplet interpretation in initialization dominiq at lps dot ens dot fr
                   ` (2 preceding siblings ...)
  2006-09-10 17:13 ` pault at gcc dot gnu dot org
@ 2006-09-10 17:32 ` pault at gcc dot gnu dot org
  2006-09-10 19:44 ` pault at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-09-10 17:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2006-09-10 17:32 -------
Subject: Bug 28923

Author: pault
Date: Sun Sep 10 17:32:22 2006
New Revision: 116819

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116819
Log:
2006-09-09  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/28923
        expr.c (find_array_section): Only use the array lower and upper
        bounds for the start and end of the sections, where the expr is
        NULL.

        PR fortran/28959
        trans-types.c (gfc_get_derived_type): Use the parent namespace of
        the procedure if the type's own namespace does not have a parent.


2006-09-09  Paul Thomas  <pault@gcc.gnu.org>

        PR libfortran/28947
        * m4/matmul.m4: For the case where the second input argument is
        transposed, ensure that the case with rank (a) == 1 is
        correctly calculated.
        * generated/matmul_r4.c: Regenerate.
        * generated/matmul_r8.c: Regenerate.
        * generated/matmul_r10.c: Regenerate.
        * generated/matmul_r16.c: Regenerate.
        * generated/matmul_c4.c: Regenerate.
        * generated/matmul_c8.c: Regenerate.
        * generated/matmul_c10.c: Regenerate.
        * generated/matmul_c16.c: Regenerate.
        * generated/matmul_i4.c: Regenerate.
        * generated/matmul_i8.c: Regenerate.
        * generated/matmul_i16.c: Regenerate.


2006-09-09  Paul Thomas  <pault@gcc.gnu.org>

        PR libfortran/28923
        gfortran.dg/array_initializer_2.f90: Fill in missing index start value.
        gfortran.dg/array_initializer_3.f90: New test.

        PR libfortran/28947
        gfortran.dg/matmul_4.f90: New test.

        PR fortran/28959
        gfortran.dg/used_types_10: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/array_initializer_3.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/matmul_4.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/used_types_10.f90


-- 


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


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

* [Bug fortran/28923] Bad triplet interpretation in initialization
  2006-09-01  8:58 [Bug fortran/28923] New: Bad triplet interpretation in initialization dominiq at lps dot ens dot fr
                   ` (3 preceding siblings ...)
  2006-09-10 17:32 ` pault at gcc dot gnu dot org
@ 2006-09-10 19:44 ` pault at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-09-10 19:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2006-09-10 19:43 -------
Fixed on trunk and 4.1

Paul


-- 

pault at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-09-10 19:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-01  8:58 [Bug fortran/28923] New: Bad triplet interpretation in initialization dominiq at lps dot ens dot fr
2006-09-05 19:41 ` [Bug fortran/28923] " pault at gcc dot gnu dot org
2006-09-09 12:36 ` patchapp at dberlin dot org
2006-09-10 17:13 ` pault at gcc dot gnu dot org
2006-09-10 17:32 ` pault at gcc dot gnu dot org
2006-09-10 19:44 ` pault at gcc dot gnu dot org

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