spurious warning for -Wconversion?

Brian Barnes bcbarnes@gmail.com
Tue Jan 29 02:13:00 GMT 2008


Hello,

I have recently had the chance to compile some code using - 
Wconversion and a loop that may iterate more than 2.2 billion times.   
There is a compiler warning of this sort which I cannot resolve:

nell:~/work/bit barnes$ gfortran -Wconversion -o t.x testcase.f
testcase.f:7.16:

       do i=1_8,n
                1
Warning: Conversion from INTEGER(4) to INTEGER(8) at (1)
---
       program testcase
       implicit none
       integer(8) i,n

       n=1_8

       do i=1_8,n
       enddo

       end
---

The only variables in the testcase are 8-byte integers, yet I get  
that conversion warning.  I skimmed the gfortran bugzilla and did not  
notice anything similar.  If the loop is executed 2.2 billion times  
(n=2 200 000 000_8), it does run each instance, so I know the do loop  
is not being truncated at the limit of a 4-byte integer.  Have I  
found a diagnostics bug, or am I misunderstanding something?

Thanks for reading; I am looking forward to the release of 4.3.0!

sincerely,

Brian

---
nell:~/work/bit barnes$ gfortran -v
Using built-in specs.
Target: i686-apple-darwin8
Configured with: ../gcc-4.2.2/configure --prefix=/sw --prefix=/sw/lib/ 
gcc4.2 --mandir=/sw/share/man --infodir=/sw/share/info --enable- 
languages=c,c++,fortran,objc,java --with-arch=nocona --with- 
tune=generic --host=i686-apple-darwin8 --with-gmp=/sw --with-libiconv- 
prefix=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x- 
libraries=/usr/X11R6/lib
Thread model: posix
gcc version 4.2.2



More information about the Fortran mailing list