[Bug fortran/53685] New: surprising warns about transfer with explicit character range

ajmay81 at googlemail dot com gcc-bugzilla@gcc.gnu.org
Fri Jun 15 14:35:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53685

             Bug #: 53685
           Summary: surprising warns about transfer with explicit
                    character range
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ajmay81@googlemail.com


Fortran code:

      subroutine test()
      implicit none
      character(len=4) :: record_type
      integer          :: i
      i=transfer(record_type,i) ! no warning
      i=transfer(record_type(1:4),i) ! warning
      return
      end

gfortran -c -Wsurprising test.f
test.f:6.17:

      i=transfer(record_type(1:4),i) ! warning                          
                 1
Warning: Intrinsic TRANSFER at (1) has partly undefined result: source size 0 <
result size 4

When the string length is explicitly given the compiler thinks it is length 0,
even though it is the same length as the previous instance.

Seen with 4.7.1 built from source.



More information about the Gcc-bugs mailing list