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

            Bug ID: 68225
           Summary: ICE with -Wrealloc-lhs-all on structure constructor
                    with allocatable components
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gerhard.steinmetz.fort...@t-online.de
  Target Milestone: ---

This case aborts with option -Wrealloc-lhs-all :

$ cat y0.f90
program p
   type t
      integer, allocatable :: a
   end type
   type(t) :: x
   x = t()
   print *, allocated(x%a), x%a
end


$ gfortran -g -O0 -Wall -Wrealloc-lhs-all y0.f90

y0.f90:6:0:

    x = t()
 1
in gfc_format_decoder, at fortran/error.c:1124


---

Without -Wrealloc-lhs-all :

$ gfortran -g -O0 -Wall -fcheck=all -Wrealloc-lhs y0.f90
$ a.out
 T           0


Note, F2008 4.5.10 specifies : If an allocatable component has
no corresponding component-data-source, then that component has
an allocation status of unallocated.

Reply via email to