[Bug fortran/47523] Concatenation with deferred length character with lhs variable

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 28 22:05:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47523

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-28 21:04:40 UTC ---
I think I/O is OK - the issue is probably the same as PR 47519: Mishandling of
intrinsic operations. Though, this case looks a bit different than the other
PR.

void
concat_string (gfc_charlen_type destlen, CHARTYPE * dest,
               gfc_charlen_type len1, const CHARTYPE * s1,
               gfc_charlen_type len2, const CHARTYPE * s2)

But for   a = a // 'x'


        if (a != 0B) goto L.3;
        L.3:;
        a = (character(kind=1)[1:.a] *) __builtin_realloc ((void *) a,
(<unnamed-unsigned:64>) (.a + 1));
        L.4:;
        .a = .a + 1;
        D.1536 = (.a + 1) * 64;
        D.1537 = (void * restrict) __builtin_malloc (MAX_EXPR
<(<unnamed-unsigned:64>) D.1536, 1>);
        pstr.0 = (character(kind=1)[1:] *) D.1537;
        _gfortran_concat_string (.a + 1, pstr.0, .a, a, 1, &"x"[1]{lb: 1 sz:
1});

Thus, one first allocates "a", increments the length and then uses as "s1"
argument to the intrinsic. That cannot work ...



More information about the Gcc-bugs mailing list