This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR 78534 Change character length from int to size_t
- From: Thomas Koenig <tkoenig at netcologne dot de>
- To: Janne Blomqvist <blomqvist dot janne at gmail dot com>, fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sat, 30 Dec 2017 15:59:32 +0100
- Subject: Re: [PATCH] PR 78534 Change character length from int to size_t
- Authentication-results: sourceware.org; auth=none
- References: <1514554310-27231-1-git-send-email-blomqvist.janne@gmail.com>
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