[Bug fortran/65144] Problems printing, reading and accessing substrings of ISO_10646 character variables

zbeekman at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Mar 3 16:43:00 GMT 2015


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

--- Comment #3 from Zaak <zbeekman at gmail dot com> ---
Similarly if I try to use a substring in an if statement:

program test3
  INTEGER,PARAMETER :: ucs4 = selected_char_kind("ISO_10646")
  CHARACTER(3,UCS4),PARAMETER ::
unip=CHAR(INT(Z'5e74'),UCS4)//CHAR(INT(Z'6708'),ucs4)//CHAR(INT(Z'65e5'),ucs4)
  character(3,UCS4) :: uni
  uni = unip
  open(6, encoding="utf-8")
  print *, uni
  print *, uni(2:2)
  print *, unip
  print *, "'",unip(1:1),"'"
  if ( unip(2:2) == CHAR(INT(Z'6708'),ucs4)) print*, unip(2:2) ! This SHOULD be
true
end program test3

I get the following error:

$ gfortran --version && gfortran ISO_10646.f90
GNU Fortran (Homebrew gcc 4.9.2_1) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

ISO_10646.f90:11.7:

  if ( unip(2:2) == CHAR(INT(Z'6708'),ucs4)) print*, unip(2:2) ! This SHOULD be
       1
Error: Operands of comparison operator '==' at (1) are
CHARACTER(1)/CHARACTER(4)



More information about the Gcc-bugs mailing list