public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35951]  New: Unexpected erro "Expected another dimension in array declaration"
@ 2008-04-16  1:51 john dot young at jrc dot co dot jp
  2008-04-16  1:51 ` [Bug fortran/35951] " john dot young at jrc dot co dot jp
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: john dot young at jrc dot co dot jp @ 2008-04-16  1:51 UTC (permalink / raw)
  To: gcc-bugs

The below code produces the error "Expected another dimension in array
declaration at 1".  It only seems to occur when the passed argument that
contains the array dimension is a derived type and not an integer.  Also, it
only occurs when the derived-type declaration is below (not above) the
declaration of the array.  When the dimension is an integer and not a
derived-type component, either order compiles correctly.  I tested on g95 and
intel and obtained no error.  

My system is WindowsXP, cygwin, and gcc version 4.3.0 20080212 (experimental)
[trunk revision 132252]

John

!==========================================
module test_module
implicit none

  type tt
    integer :: n
  end type tt

contains
!=======================================================================
!=======================================================================
subroutine test_sub_1(z,t)
implicit none

real :: z(t%n)  !this order produces compiler error "Expected another dimension
in array declaration at 1"
type (tt) :: t

!type (tt) :: t   !this order compiles correctly
!real :: z(t%n) 


end subroutine test_sub_1
!=======================================================================
!
subroutine test_sub_2(z,m)
implicit none

real    :: z(m)   !this order compiles correctly
integer :: m

!integer,intent(in) :: m    !this order compiles correctly too
!real, intent(out) :: z(m)

end subroutine test_sub_2
!=======================================================================
!=======================================================================
end module test_module


-- 
           Summary: Unexpected erro "Expected another dimension in array
                    declaration"
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: john dot young at jrc dot co dot jp
GCC target triplet: i686-pc-cygwin


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


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

* [Bug fortran/35951] Unexpected erro "Expected another dimension in array declaration"
  2008-04-16  1:51 [Bug fortran/35951] New: Unexpected erro "Expected another dimension in array declaration" john dot young at jrc dot co dot jp
@ 2008-04-16  1:51 ` john dot young at jrc dot co dot jp
  2008-04-16  1:58 ` john dot young at jrc dot co dot jp
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: john dot young at jrc dot co dot jp @ 2008-04-16  1:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from john dot young at jrc dot co dot jp  2008-04-16 01:51 -------
Created an attachment (id=15481)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15481&action=view)
code to produce error described in bug report


-- 


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


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

* [Bug fortran/35951] Unexpected erro "Expected another dimension in array declaration"
  2008-04-16  1:51 [Bug fortran/35951] New: Unexpected erro "Expected another dimension in array declaration" john dot young at jrc dot co dot jp
  2008-04-16  1:51 ` [Bug fortran/35951] " john dot young at jrc dot co dot jp
@ 2008-04-16  1:58 ` john dot young at jrc dot co dot jp
  2008-04-16  5:06 ` burnus at gcc dot gnu dot org
  2009-01-03 23:46 ` dfranke at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: john dot young at jrc dot co dot jp @ 2008-04-16  1:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from john dot young at jrc dot co dot jp  2008-04-16 01:57 -------
I take back my comment that intel's compiler produces no error.  Intel 8.1
produces an error when the structure declaration is below the array
declaration.  I do not know the standard well enough to know whether this is a
bug or not.  G95 still compiles with no error.

John


-- 


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


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

* [Bug fortran/35951] Unexpected erro "Expected another dimension in array declaration"
  2008-04-16  1:51 [Bug fortran/35951] New: Unexpected erro "Expected another dimension in array declaration" john dot young at jrc dot co dot jp
  2008-04-16  1:51 ` [Bug fortran/35951] " john dot young at jrc dot co dot jp
  2008-04-16  1:58 ` john dot young at jrc dot co dot jp
@ 2008-04-16  5:06 ` burnus at gcc dot gnu dot org
  2009-01-03 23:46 ` dfranke at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-04-16  5:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2008-04-16 05:05 -------
I think this is wrong:
  real :: z(t%n)
  type (tt) :: t

the order has to be reversed. The following is also invalid (with implicit
none):

  real    :: z(m)
  integer :: m

Most compilers support this, however.

I think gfortran behaves OK; though, one could argue that for consistency also
the first has to be supported or that second one should be diagnosed (only with
-std=, there are too many programs with reversed order).

When I have time, I will search for the quote from the standard.


-- 


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


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

* [Bug fortran/35951] Unexpected erro "Expected another dimension in array declaration"
  2008-04-16  1:51 [Bug fortran/35951] New: Unexpected erro "Expected another dimension in array declaration" john dot young at jrc dot co dot jp
                   ` (2 preceding siblings ...)
  2008-04-16  5:06 ` burnus at gcc dot gnu dot org
@ 2009-01-03 23:46 ` dfranke at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-01-03 23:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dfranke at gcc dot gnu dot org  2009-01-03 23:46 -------


*** This bug has been marked as a duplicate of 31560 ***


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2009-01-03 23:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-16  1:51 [Bug fortran/35951] New: Unexpected erro "Expected another dimension in array declaration" john dot young at jrc dot co dot jp
2008-04-16  1:51 ` [Bug fortran/35951] " john dot young at jrc dot co dot jp
2008-04-16  1:58 ` john dot young at jrc dot co dot jp
2008-04-16  5:06 ` burnus at gcc dot gnu dot org
2009-01-03 23:46 ` dfranke 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).