This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/34476] Parameters: Bogus out of bounds error in array constructor



------- Comment #2 from w6ws at earthlink dot net  2007-12-17 15:33 -------
Here is an additional variant of this bug:

program init_bug
  implicit none

  integer :: i
  character(11), parameter :: string="hello world"

! This compiles:
  character, parameter :: up_string(len (string)) =  &
    (/ (string(i:i), i=1, len (string)) /)

  integer, parameter :: bytes(len (string)) =  &
    (/ (iachar (string(i:i)), i=1, len (string)) /)

  integer, parameter :: up_bytes(len (string)) =  &
    (/ (iachar (up_string(i)), i=1, size (up_string)) /)

  print *, string
  print *, up_string

  print *, bytes
  print *, up_bytes

end program

Besides the out-of-bounds error, it also gives a 'cannot appear in the
expression error':


    (/ (iachar (up_string(i)), i=1, size (up_string)) /)
                         1
Error: index in dimension 1 is out of bounds at (1)
abuse_init4.f90:12.25:

    (/ (iachar (string(i:i)), i=1, len (string)) /)
                        1
Error: Variable 'i' cannot appear in the expression at (1)
abuse_init4.f90:21.19:

  print *, up_bytes
                  1
Error: Symbol 'up_bytes' at (1) has no IMPLICIT type


-- 

w6ws at earthlink dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |w6ws at earthlink dot net


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]