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

            Bug ID: 113883
           Summary: allocatable length parameter used but is undefined
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kargl at gcc dot gnu.org
  Target Milestone: ---

All,

I stumbled across the following issue with my code.  Consider, 

! { dg-do compile }
! { dg-options "-Werror -Wall" }
module foo
   contains
      subroutine bar 
         character(len=:), allocatable :: s(:)
         call bah(s)
      end subroutine bar
end module foo

Currently, if this compiled with '-Werror -Wall' the result is

% gfcx -Wall -Werror -c gcc/testsuite/gfortran.dg/allocatable_length.f90
gcc/testsuite/gfortran.dg/allocatable_length.f90:6:46:

    6 |          character(len=:), allocatable :: s(:)
      |                                              ^
Error: '.s' is used uninitialized [-Werror=uninitialized]
gcc/testsuite/gfortran.dg/allocatable_length.f90:5:20:

    5 |       subroutine bar
      |                    ^
note: '.s' was declared here
f951: all warnings being treated as errors

I tracked down the location where the issue occurs and Mikael suggested
the patch that ultimately fixes the issue.  I'll attach it in a follow-up.

Reply via email to