Fortran code:
program test
implicit none
character*2 a(1)
character*24 trop
integer i,j
i=1
j=2
trop='b'//a(1)(i:j) ! fine
trop='b'//a(1)(1:2) ! warning
trop=a(1)(1:2)//'b' ! warning
trop=a(1)(1:2) ! fine
end
Compiled with:
gfortran -Wconversion test.f
produces no warnings, but with 8-byte integers:
gfortran -Wconversion -fdefault-integer-8 test.f
test.f:10.23:
trop='b'//a(1)(1:2) ! warning
1
Warning: Conversion from INTEGER(4) to INTEGER(8) at (1)
test.f:11.18:
trop=a(1)(1:2)//'b' ! warning
1
Warning: Conversion from INTEGER(4) to INTEGER(8) at (1)
Using gfortran build that ships with openSuSE 11.1:
Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.3
--enable-ssp --disable-libssp --with-bugurl=http://bugs.opensuse.org/
--with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap
--with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --program-suffix=-4.3
--enable-linux-futex --without-system-libunwind --with-cpu=generic
--build=x86_64-suse-linux
Thread model: posix
gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux)
--
Summary: integer constants not promoted with -fdefault-integer-8
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ajmay81 at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40142