[Bug fortran/70914] ICE in gimplify_var_or_parm_decl, at gimplify.c:1851 (and endless compilation)

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 6 22:33:00 GMT 2016


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

--- Comment #4 from kargl at gcc dot gnu.org ---
(In reply to Gerhard Steinmetz from comment #3)
> Indeed, I can confirm that all examples from comment 0 are now working
> (and compiling without an ICE) when using gfortran-7-20160703.
> 
> 
> 
> Though, if not covered elsewhere, only one remaining problem :
> 
> 
> $ cat z6.f90
> program p
>    character(:), pointer :: z
>    z = 'z'
>    z = z
>    z = z
>    z = z
>    print *, z
> end
> 
> 
> $ gfortran-7-20160703 -Wall z6.f90
> z6.f90:3:0:
> 
>     z = 'z'
> 
> Warning: '.z' is used uninitialized in this function [-Wuninitialized]
> z6.f90:3:0: Warning: 'z' may be used uninitialized in this function
> [-Wmaybe-uninitialized]

Compiling and working are 2 different beast.

cat a.f90
program p
   character(:), pointer :: z
   z = 'xy'
   print *, z
end
% gfc7 -o z -Wall -fdump-tree-original a.f90
a.f90:3:0:

    z = 'xy'

Warning: '.z' is used uninitialized in this function [-Wuninitialized]
a.f90:3:0: Warning: 'z' may be used uninitialized in this function
[-Wmaybe-uninitialized]
troutmask:sgk[224] ./z
Segmentation fault (core dumped)


From the dump, gfortran is using junk from memory

  character(kind=1)[1:.z] * z;
  integer(kind=4) .z;

  {
    integer(kind=4) D.3415;

    D.3415 = .z;
    if (D.3415 != 0)
      {
        if ((unsigned long) D.3415 <= 2)
          {
            __builtin_memmove ((void *) z, (void *) &"xy"[1]{lb: 1 sz: 1},
                               (unsigned long) D.3415);
          }
        else
          {
            __builtin_memmove ((void *) z, (void *) &"xy"[1]{lb: 1 sz: 1}, 2);
            __builtin_memset ((void *) z + 2, 32,
                              (unsigned long) D.3415 + 18446744073709551614);
          }
      }
  }


More information about the Gcc-bugs mailing list