This is the mail archive of the gcc-patches@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]

Re: [PATCH] PR 78534 Change character length from int to size_t


Hi Janne,

In order to handle large character lengths on (L)LP64 targets, switch
the GFortran character length from an int to a size_t.

Just running some tests on gcc110 (the big-endian PPC machine from
the compile farm).

Something does not seem to work with I/O with long strings.

With

program main
  character(len=2_8**33), parameter :: a = ""
  character(len=2_8**33) :: b
  print '(A),a
  b = ""
  print '(A)',b
end program main

I get

$ strace ./a.out > /dev/null
...
write(1, "\n", 1)                       = 1
write(1, "\n", 1)                       = 1

so I suspect there still is a 32-bit quantity for string lengths
lurking somewhere in the I/O library.

The following program causes a segfault on compilation:

program main
  integer(8), parameter :: n=2_8**32
  character(len=*), parameter :: a1 = repeat('x',n)
end program main

The program

program main
  integer(8), parameter :: n=2_8**32
  character(len=n), parameter :: a1 = repeat('x',n), a2 = repeat('y',n)
  character(len=*), parameter :: a3 = a1 // a2
end program main

is rejected with

tkoenig@gcc1-power7 String]$ gfortran  concat.f90
concat.f90:4:37:

   character(len=*), parameter :: a3 = a1 // a2
                                     1
Error: Function ‘a1’ in initialization expression at (1) must be an intrinsic function

That's all I could find for the moment. I will continue looking.
Thanks for tackling this!

Regards

	Thomas


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