This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/20473] false arithmetic with short integers
- From: "tobi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Mar 2005 19:03:10 -0000
- Subject: [Bug fortran/20473] false arithmetic with short integers
- References: <20050314184946.20473.ralph.doering@web.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From tobi at gcc dot gnu dot org 2005-03-14 19:03 -------
"2*i1" implicitly converts i1 to default integer kind, and then performs the
multiplication. g77's behavior is correct. It is unfortunate that g77 doesn't
have the -Wconversion command-line option, with gfortran you get:
[tobi@marktplatz tests]$ gfortran pr20473.f90 -Wconversion
In file pr20473.f90:8
print*, i1+i1, 2*i1
1
Warning: Conversion from INTEGER(1) to INTEGER(4) at (1)
In file pr20473.f90:10
print*, i2+i2, 2*i2
1
Warning: Conversion from INTEGER(2) to INTEGER(4) at (1)
In file pr20473.f90:7
i1=100
1
Warning: Conversion from INTEGER(4) to INTEGER(1) at (1)
In file pr20473.f90:9
i2=20000
1
Warning: Conversion from INTEGER(4) to INTEGER(2) at (1)
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20473