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

            Bug ID: 94091
           Summary: Erroneous __builtin_memcpy warning for character
                    assignment
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mws116 at usa dot com
  Target Milestone: ---

The test program below illustrates the erroneous warning.  The variable kk is
determined at runtime and doesn't match the size reported by the warning
message.


program tester

  character(50) cname,fred

  fred='1234567890123456789012345678901234567890' ! 40 characters

  kk=len_trim(fred)

  cname=fred(5:kk)

  print *,kk,cname

end program tester


gfortran -g -o tester.exe tester.f90

    9 |   cname=fred(5:kk)
      | 
Warning: ‘__builtin_memcpy’ reading 50 bytes from a region of size 46
[-Wstringop-overflow=]


Linux centos7 3.10.0-514.el7.x86_64 
GNU Fortran (GCC) 9.2.0

Reply via email to