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

--- Comment #9 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Gerhard Steinmetz from comment #2)
> Another group of examples.
> First case is working in a sufficient manner.
> Concatenating two empty hulls (zero len and size, respectivly)
> gives an empty hull as result again.
> 
> 
> $ cat zz1.f90
> program p
>    character(*), parameter :: c1(*) = [character(*) :: 'a'] // [character(*)
> :: 'z']
>    character(*), parameter :: c2(*) = [character(0) ::] // [character(0) ::]
>    character(*), parameter :: c3(*) = [character(0) ::] // [character(*) ::]
>    character(*), parameter :: c4(*) = [character(0) ::]
>    print *, 'c1: ', len(c1), size(c1), c1
>    print *, 'c2: ', len(c2), size(c2), c2
>    print *, 'c3: ', len(c3), size(c3), c3
>    print *, 'c4: ', len(c4), size(c4), c4
> end
> 
> 
> $ gfortran-6 -g -O0 -Wall -fcheck=all zz1.f90
> $ a.out
>  c1:            2           1 az
>  c2:            0           0
>  c3:            0           0
>  c4:            0           0
> 
> ---
> 
> 
> Next case is questionable : no error, unexpected results.
> 
> 
> $ cat zz2.f90
> program p
>    character(*), parameter :: c5(*) = [character(*) :: 'a'] // [character(0)
> ::]
>    character(*), parameter :: c6(*) = [character(0) ::] // [character(*) ::
> 'z']
>    print *, 'c5: ', len(c5), size(c5), c5
>    print *, 'c6: ', len(c6), size(c6), c6
> end
> 
> 
> $ gfortran-6 -g -O0 -Wall -fcheck=all zz2.f90
> $ a.out
>  c5:            0           0
>  c6:            0           0
> 
> 
> 
> Errors detected with alternative code :
> 
> $ cat zz3.f90
> program p
>    character(*), parameter :: b1(*) = [character(*) :: 'a']
>    character(*), parameter :: b2(*) = [character(0) ::]
>    character(*), parameter :: b3(*) = b1 // b2
> !  character(*), parameter :: b4(*) = b2 // b1
>    print *, 'b1: ', len(b1), size(b1), b2
>    print *, 'b2: ', len(b2), size(b2), b2
>    print *, 'b3: ', len(b3), size(b3), b3
> !  print *, 'b4: ', len(b4), size(b4), b4
> end
> 
> 
> $ gfortran-6 -g -O0 -Wall -fcheck=all zz3.f90
> zz3.f90:4:37-43:
> 
>     character(*), parameter :: b3(*) = b1 // b2
>                                      1     2
> Error: Shapes for operands at (1) and (2) are not conformable
> zz3.f90:8:24:
> 
>     print *, 'b3: ', len(b3), size(b3), b3
>                         1
> Error: 'string' argument of 'len' intrinsic at (1) must be CHARACTER
> zz3.f90:8:34:
> 
>     print *, 'b3: ', len(b3), size(b3), b3
>                                   1
> Error: 'array' argument of 'size' intrinsic at (1) must be an array

All these yield the error:
"Type-spec at (1) cannot contain an asterisk for a type parameter"
on trunk. Again, I will check previous branches in a week or so.

Paul

Reply via email to