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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
In .original I see

      if (world_rank == 0)
        {
...
                    stat.0 = 0;
                    error_messages.data = (void * restrict) __builtin_malloc
(MAX_EXPR <size.1, 1>);
                    if (__builtin_expect ((integer(kind=8))
(error_messages.data == 0B), 0, 40))
                      {
                        stat.0 = 5014;
                      }
                  }
              }
            if (stat.0 == 0)
              {
                error_messages.dim[0].lbound = 1;
                error_messages.dim[0].ubound = (integer(kind=8)) world_size;
                error_messages.dim[0].stride = 1;
                error_messages.offset = -1;
              }
            if (__builtin_expect ((integer(kind=8)) (stat.0 != 0), 0, 40)) goto
L.2;
            L.2:;
            allocstat = stat.0;
        }
...
      L.1:;
      if (world_rank == 0)
        {
          {
            integer(kind=4) limit.4;
            character(kind=1)[0:][1:80] * restrict D.3813;
            integer(kind=8) D.3814;
            integer(kind=8) D.3815;
            integer(kind=8) D.3816;

            limit.4 = -2147483648;
            D.3813 = (character(kind=1)[0:][1:80] * restrict)
error_messages.data;
            D.3814 = error_messages.offset;
            D.3815 = error_messages.dim[0].lbound;
            D.3816 = error_messages.dim[0].ubound;

so when error_messages allocation fails then you access uninitialized
error_messages.

Not sure if

      allocate(error_messages(world_size), stat=allocstat)
      max_err_len = maxval(len_trim(error_messages))

is well-defined fortran iff allocation fails?  I suppose not, so
warning is correct, testcase is broken?

Reply via email to