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/77908] New: Array operation fails for arrays with "long" indices


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77908

            Bug ID: 77908
           Summary: Array operation fails for arrays with "long" indices
           Product: gcc
           Version: 5.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arjen.markus895 at gmail dot com
  Target Milestone: ---

Experimenting with array indices of non-default kind - "long" or "large"
integers - I happened to stumble on the following problem:

array operations on such arrays cause the program to stop prematurely.

Here is a minimal program that exhibits this behaviour:

----

! error_index_long --
!     Using "long" integers as indices fails
!
program error_index_long
    implicit none

    integer, parameter                         :: long =
selected_int_kind(range(1)+1)
    integer(kind=long), parameter              :: bignumber = huge(1_long)

    integer, dimension(bignumber-10:bignumber) :: value

    write(*,*) 'Running ...'

    value = 1

    write(*, '(a,11i5)') 'Values: ', value

    write(*,*) 'Done'

end program error_index_long

----

Using Cygwin on Windows 7, I see the following behaviour:
- The program is accepted by the compiler
- The program starts and prints "Running ..." but then it stops. The final text
is not printed.

If I turn the array operation "value = 1" into a loop, it does work.

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