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

            Bug ID: 91442
           Summary: Wrong "may be used uninitialized" warning with
                    allocation on assignment
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jellby at yahoo dot com
  Target Milestone: ---

Simple test case:

!=======================
program test
character(len=:), allocatable :: string
string='Hello world!'
write(6,*) string
end program
!=======================

Compile with "-Wall":

test.f90:3:0:

 string=''

Warning: ‘.string’ may be used uninitialized in this function
[-Wmaybe-uninitialized]

Adding "-O1" removes the warning, though.

Reply via email to