public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/65141] ISO_10646 constant parameters convert kind when used with substring references
       [not found] <bug-65141-4@http.gcc.gnu.org/bugzilla/>
@ 2015-02-21  0:27 ` jvdelisle at gcc dot gnu.org
  2015-10-13  8:51 ` alexandros.syrakos at outlook dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2015-02-21  0:27 UTC (permalink / raw)
  To: gcc-bugs

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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-02-20
                 CC|                            |jvdelisle at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Confirmed and the problem is in the front end side.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/65141] ISO_10646 constant parameters convert kind when used with substring references
       [not found] <bug-65141-4@http.gcc.gnu.org/bugzilla/>
  2015-02-21  0:27 ` [Bug fortran/65141] ISO_10646 constant parameters convert kind when used with substring references jvdelisle at gcc dot gnu.org
@ 2015-10-13  8:51 ` alexandros.syrakos at outlook dot com
  2015-10-13  9:02 ` dominiq at lps dot ens.fr
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: alexandros.syrakos at outlook dot com @ 2015-10-13  8:51 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandros Syrakos <alexandros.syrakos at outlook dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alexandros.syrakos@outlook.
                   |                            |com

--- Comment #2 from Alexandros Syrakos <alexandros.syrakos at outlook dot com> ---
The bug is still present in gfortran 5.2.0. It makes it impossible to modify a
substring of a unicode string; it has to be treated as a whole.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/65141] ISO_10646 constant parameters convert kind when used with substring references
       [not found] <bug-65141-4@http.gcc.gnu.org/bugzilla/>
  2015-02-21  0:27 ` [Bug fortran/65141] ISO_10646 constant parameters convert kind when used with substring references jvdelisle at gcc dot gnu.org
  2015-10-13  8:51 ` alexandros.syrakos at outlook dot com
@ 2015-10-13  9:02 ` dominiq at lps dot ens.fr
  2015-10-13 15:58 ` alexandros.syrakos at outlook dot com
  2021-10-10 19:52 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-13  9:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Confirmed and the problem is in the front end side.

Yes, if I remove 'parameter' in the definition of 'string', I get the correct
KIND for the section.

> The bug is still present in gfortran 5.2.0. It makes it impossible
> to modify a substring of a unicode string; it has to be treated as a whole.

Still on trunk (6.0)!-(usual answer: "what did you do to fix the PR?").


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/65141] ISO_10646 constant parameters convert kind when used with substring references
       [not found] <bug-65141-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2015-10-13  9:02 ` dominiq at lps dot ens.fr
@ 2015-10-13 15:58 ` alexandros.syrakos at outlook dot com
  2021-10-10 19:52 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: alexandros.syrakos at outlook dot com @ 2015-10-13 15:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Alexandros Syrakos <alexandros.syrakos at outlook dot com> ---
Dominique, thanks for the quick reply. Your answer is just, but I'm afraid that
due to lack of appropriate skills I can't be much more help than reporting
bugs.

Concerning the present bug, let me add some more information: Your suggestion
of removing the "parameter" keyword is nice as a workaround but it doesn't work
for arrays of strings. Consider for example the following modification of the
original code:



program ISO_CONST_SUBST_PR
    implicit none
    integer, parameter :: UNICODE=selected_char_kind('ISO_10646')
    integer, parameter :: DEFAULT=selected_char_kind('DEFAULT')
!    character(kind=UNICODE,len=*),parameter :: string='my string'
    character(kind=UNICODE,len=9) :: string='my string'
    character(kind=UNICODE,len=9), dimension(2) :: page

    page = string

    write(*,'(A, I0, A, I0)') 'Unicode and default character kinds are:
',UNICODE,', ',DEFAULT
    write(*,'(A, I0)') 'kind(string) should be UNICODE and is UNICODE for me:
',kind(string)
    write(*,'(A, I0)') 'kind(string(2:4)) should be UNICODE and is UNICODE for
me: ',kind(string(2:4))
    write(*,'(A, I0)') 'kind(page) should be UNICODE and is UNICODE for me:
',kind(page)
    write(*,'(A, I0)') 'kind(page(1)) should be UNICODE and is UNICODE for me:
',kind(page(1))
    write(*,'(A, I0)') 'kind(page(1)(2:4)) should be UNICODE and is DEFAULT for
me: ',kind(page(1)(2:4))
end program ISO_CONST_SUBST_PR



With gfortran 5.2.0 I get kind(page(1)(2:4)) == DEFAULT instead of UNICODE,
although no parameters are involved. Let me include another sample code:



program test
use iso_fortran_env
implicit none
integer, parameter ::ucs4 = selected_char_kind( 'ISO_10646' )
character(kind=ucs4) :: a
character(kind=ucs4, len=8), dimension(2) :: page

a = char( int(z'f17c'), ucs4 )

open (output_unit, encoding='UTF-8')
page(1) = repeat(a,8)
print "(a,i0,2a)", "kind(page(1)) is ", kind(page(1)), "; page(1) contains: ",
page(1)

page(1)(2:4) = a
print "(a,i0,2a)", "kind(page(1)) is ", kind(page(1)), "; page(1) contains: ",
page(1)
end program test



You can see that, once substring page(1)(2:4) has been modified, although the
kind of page(1) is unaltered, printing page(1) to the screen gives rubbish.
This practically makes it impossible to use arrays of unicode strings.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/65141] ISO_10646 constant parameters convert kind when used with substring references
       [not found] <bug-65141-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2015-10-13 15:58 ` alexandros.syrakos at outlook dot com
@ 2021-10-10 19:52 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-10-10 19:52 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org
             Status|NEW                         |RESOLVED
      Known to work|                            |11.2.1, 12.0
      Known to fail|                            |10.3.1, 4.8.5, 4.9.3,
                   |                            |5.2.0, 6.0
         Resolution|---                         |DUPLICATE

--- Comment #5 from anlauf at gcc dot gnu.org ---
The testcase in comment#0 works for me with 12.0 and 11.2.1, the same versions
that work for me with PR67972.  I also do not see anything unexpected for the
other cases.

I'll mark this one as a duplicate.

Please correct me if I'm wrong and open a new PR with more details.

*** This bug has been marked as a duplicate of bug 67972 ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-10 19:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-65141-4@http.gcc.gnu.org/bugzilla/>
2015-02-21  0:27 ` [Bug fortran/65141] ISO_10646 constant parameters convert kind when used with substring references jvdelisle at gcc dot gnu.org
2015-10-13  8:51 ` alexandros.syrakos at outlook dot com
2015-10-13  9:02 ` dominiq at lps dot ens.fr
2015-10-13 15:58 ` alexandros.syrakos at outlook dot com
2021-10-10 19:52 ` anlauf at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).