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

Johannes Nendwich <a08727063 at unet dot univie.ac.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |a08727063 at unet dot 
univie.ac.at

--- Comment #3 from Johannes Nendwich <a08727063 at unet dot univie.ac.at> ---
Still present -- and wrong execution -- in

gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04)

Compiling and running (-n 2) the following example

PROGRAM Test_Character_Coarray
IMPLICIT NONE
INTEGER                          :: i
CHARACTER(LEN=3)                 :: txt = "abc" ! TeXT
CHARACTER(LEN=3), CODIMENSION[*] :: tyt = "XYZ" ! coarraY TexT
i = THIS_IMAGE()
PRINT '(  A,I0 ,3A)', "[", i, "]: txt ....... = '", txt     , "'"
PRINT '(  A,I0 ,3A)', "[", i, "]: tyt ....... = '", tyt     , "'"
PRINT '(  A,I0 ,3A)', "[", i, "]: txt(1:1) .. = '", txt(1:1), "'"
!PRINT '( A,I0 ,3A)', "[", i, "]: tyt(1:1) .. = '", tyt(1:1), "'"
!                                                     1
! Error: Rank mismatch in array reference at (1) (1/0)
PRINT '(2(A,I0),3A)', "[", i, "]: tyt[", i, "](1:1) = '", tyt[i](1:1), "'"
PRINT *
END PROGRAM Test_Character_Coarray

results in

[1]: txt ....... = 'abc'
[1]: tyt ....... = 'XYZ'
[1]: txt(1:1) .. = 'a'
[1]: tyt[1](1:1) = ''

[2]: txt ....... = 'abc'
[2]: tyt ....... = 'XYZ'
[2]: txt(1:1) .. = 'a'
[2]: tyt[2](1:1) = ''

So even when using the correct syntax tyt[i](1:1) the result is wrong: ''
instead of 'X'.
  • [Bug fortran/60813] [Coarr... a08727063 at unet dot univie.ac.at via Gcc-bugs

Reply via email to