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

--- Comment #3 from martin <mscfd at gmx dot net> ---
Thanks for the patch, it does the job. But if I compile with 
"gfortran-14 -fopenmp -Wuninitialized"

then I obtain

   20 |       out = concat_f('0123456 ', some()) // ' abc'
      |                                                  ^
note: ‘slen.1’ declared here

So there still seems to be something amiss.

Here is the tree dump of the initial part of check(), where slen.1 is declared.
The problem might be the declaration of pstr.2?

__attribute__((fn spec (". r ")))
void check (integer(kind=4) & restrict i)
{
  character(kind=1) out[1:15];

  {
    struct string D.4330;
    struct string * D.4331;
    integer(kind=8) slen.1;
    character(kind=1)[1:slen.1] * pstr.2;
    character(kind=1)[1:] * pstr.3;
    void * restrict D.4336;
    integer(kind=8) D.4337;
    integer(kind=8) D.4338;
    void * D.4339;
    void * D.4340;

    D.4330 = some ();
    D.4331 = &D.4330;
        typedef character(kind=1) struct character(kind=1)[1:slen.1][1:slen.1];
    pstr.2 = 0B;
    slen.1 = 0;
    concat_f (&pstr.2, &slen.1, &"0123456 "[1]{lb: 1 sz: 1}, D.4331, 8);
    if (D.4331->chars != 0B)
      {
        __builtin_free ((void *) D.4331->chars);
        D.4331->chars = 0B;
      }
    D.4336 = (void * restrict) __builtin_malloc (MAX_EXPR <(unsigned long)
(slen.1 + 4), 1>);
    pstr.3 = (character(kind=1)[1:] *) D.4336;
    _gfortran_concat_string (slen.1 + 4, pstr.3, slen.1, pstr.2, 4, &"
abc"[1]{lb: 1 sz: 1});
    __builtin_free ((void *) pstr.2);
    D.4337 = slen.1 + 4;
    D.4338 = slen.1 + 4;
    D.4339 = (void *) &out;
    D.4340 = (void *) pstr.3;
    if (NON_LVALUE_EXPR <D.4338> <= 14)
      {
        __builtin_memmove (D.4339, D.4340, (unsigned long) NON_LVALUE_EXPR
<D.4338>);
        __builtin_memset (D.4339 + (sizetype) NON_LVALUE_EXPR <D.4338>, 32,
(unsigned long) (15 - NON_LVALUE_EXPR <D.4338>));
      }
    else
      {
        __builtin_memmove (D.4339, D.4340, 15);
      }
    __builtin_free ((void *) pstr.3);
  }
...

Reply via email to