[Bug fortran/70231] Runtime error: Different CHARACTER lengths in array constructor with allocatable array and -O0

jvdelisle at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 15 01:11:00 GMT 2016


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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-03-15
                 CC|                            |jvdelisle at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Interesting: -fdump-tree-original snippets

.... snip ....

        ch_array.dim[0].lbound = 1;
        ch_array.dim[0].ubound = 0;

.... snip ....

            D.3452 = ch_array.dim[0].lbound;
            D.3453 = ch_array.dim[0].ubound;
.... snip ....

              S.6 = D.3452;
              while (1)
                {
                  if (S.6 > D.3453) goto L.1;
                  __builtin_memmove ((void *) &(*(character(kind=1)[1][1:32] *
restrict) atmp.4.data)[offset.5][1]{lb: 1 sz: 1}, (void *) &(*D.3450)[S.6 +
D.3451], 32);
                  len.3 = 32;
                  offset.5 = offset.5 + 1;
                  S.6 = S.6 + 1;
                }
              L.1:;
            }
          }
          __builtin_memmove ((void *) &(*(character(kind=1)[1][1:32] *
restrict) atmp.4.data)[offset.5][1]{lb: 1 sz: 1}, (void *) &ch, 32);
          if ((integer(kind=8)) (len.3 != 32))
            {
              _gfortran_runtime_error_at (&"At line 8 of file
pr70231.f90"[1]{lb: 1 sz: 1}, &"Different CHARACTER lengths (%ld/%ld) in array
constructor"[1]{lb: 1 sz: 1}, (integer(kind=8)) len.3, 32);
            }

len.3 does not get set because the lower bound of ch_array is greater than the
upperbound, so when the check is done, len.3 is uninitialized.


More information about the Gcc-bugs mailing list