[Bug fortran/95837] New: derived-type components of character kind=4 – wrong code with component access (kind=4 ignored)
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 23 09:54:38 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95837
Bug ID: 95837
Summary: derived-type components of character kind=4 – wrong
code with component access (kind=4 ignored)
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
Compare:
---------------
type t
character(len=:, kind=4), pointer :: str2
end type t
type(t) :: var
character(len=:, kind=4), pointer :: str
str(1:1) = 4_"a"
str(1:2) = 4_"bc"
var%str2(1:1) = 4_"d"
var%str2(1:2) = 4_"ef"
end
---------------
The dump shows that 'str' is properly handled:
(*str)[1]{lb: 1 sz: 4} = "a\x00\x00"[1]{lb: 1 sz: 4};
__builtin_memmove ((void *) str,
(void *) &"b\x00\x00\x00c\x00\x00"[1]{lb: 1 sz: 4}, 8);
But the component reference ignores the kind=4:
*(character(kind=1) *) var.str2 = 100;
__builtin_memmove ((void *) var.str2,
(void *) &"ef"[1]{lb: 1 sz: 1}, 2);
More information about the Gcc-bugs
mailing list