This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/20473] false arithmetic with short integers


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]