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: unassig...@gcc.gnu.org ReportedBy: ajma...@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.