This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
spurious warning for -Wconversion?
- From: Brian Barnes <bcbarnes at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Date: Mon, 28 Jan 2008 13:49:25 -0600
- Subject: spurious warning for -Wconversion?
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; bh=G1Y/pCKJzn47Q1OyA+LylRo/vHHb1EXBVEcmISniPQI=; b=lIEyW75QZ3LuKsDSEPnYGYmovfcxSJ5qPq77T1hpZFdj9c1+KTd2uxM5EVzBKdFwiip18lTZpPhTudO6t1JZ1UDUmlgE1YJnbUw9ZjGBlLoMvTlmGw9Pc3c2y+SgdyHhiIIFxqB4sD35jYCSMmCFDP8UAHPUA+MtW6GDzABb7Zw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=rVPbWhFsY6YelN8A7/XGsw395X+uvk3IPDK2y2wlfWq9Q6KVvyM9D61g4KdY0Wcifx8CTceYx1Het1nGFnZXWF32mewcQI00OBlBZjg9Y5gIQlZVQ6N9JX5TtD3oKMKVSwhjLcN64ZhsyM5om88IzO+pPRL3rB3bjErhpXE0mgA=
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