Hello, On 06.11.22 21:32, Mikael Morin wrote: > Le 05/11/2022 à 23:28, Tobias Burnus a écrit : >> OK for mainline? > The trans-array.c part looks good. > A couple of nits for the trans-expr.cc part: > >> - /* Use the rhs string length and the lhs element size. */ >> - size = string_length; >> - tmp = TREE_TYPE (gfc_typenode_for_spec (&expr1->ts)); >> - tmp = TYPE_SIZE_UNIT (tmp); >> + /* Use the rhs string length and the lhs element size. Note >> that 'size' is >> + used below for the string-length comparison, only. */ >> + size = string_length, > s/,/;/ ? >> + tmp = TYPE_SIZE_UNIT (gfc_get_char_type (expr2->ts.kind)); > Here you are using the rhs element size, which contradicts the > comment, so there is certainly something to fix here (either the > comment or the code). I did remove it in between for testing – but obviously completely messed up when re-adding it :-/ However, testing indicates that expr1 vs. expr2 does not make a difference for the kind calculation: character(len=:,kind=1), allocatable :: c1l character(len=:,kind=4), allocatable :: c4l c1l = c4l c4l = c1l as the code path is different and the result is in either case: c1l = (character(kind=1)[1:.c1l] *) __builtin_realloc ((void *) c1l, MAX_EXPR <(sizetype) .c4l, 1>); c4l = (character(kind=4)[1:.c4l] *) __builtin_realloc ((void *) c4l, MAX_EXPR <(sizetype) .c1l * 4, 1>); Still, matching the comment makes sense. > As for the testcase, do you keep the code commented on purpose? I think it happened when I did 'git add' after adding the PR to the testcase, missing the commented lines I added for the explaining dumps :-/ > Can some of it be removed or uncommented? It should be all uncommented, except for the 'print' line. Updated patch attached; passed quick testing + I will fully regtest it. — I will commit it, unless more comments come up. Tobias PS: Writing patches while being tired works, but writing clean patches obvious does not. ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955