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

            Bug ID: 90238
           Summary: Bogus warning from -Warray-bounds, triggered by
                    zero-length character literal
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: townsend at astro dot wisc.edu
  Target Milestone: ---

The zero-length character literal following example program triggers a bogus
array-bounds warning:

--
program test_str

  call foo('bar')
  call foo('')

contains

  subroutine foo (a)

    character(*), intent(in) :: a

    print *, a

  end subroutine foo

end program test_str
--

Compiling with -O2 -Warray-bounds, the warning is:

test_str.f90:4:0:

   call foo('')

Warning: array subscript 1 is above array bounds of 'character(kind=1)[1:0]'
[-Warray-bounds]

Compiling at -O1 or -O0 does not trigger the warning.

cheers,

Rich

Reply via email to