Re: Newbie to gfortran needs a little help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/14/2013 1:16 PM, Mark Hounschell wrote:
I hope this is the correct list to ask. I'm porting a bunch of old fortran code and am getting thousands of these warnings I don't understand. Most all are doing some sort of add or subtract on integer*2 variables. This is just an example.

      program test
      implicit none

      integer*2 val/10/

      val = val - 1

      write(6,10)val
 10  format('val = ',I2)
      stop
      end


compiled with:

f77 -std=legacy -Wall test.f
test.f:6.12:

      val = val - 1
               1
Warning: Possible change of value in conversion from INTEGER(4) to INTEGER(2) at (1)

Thanks
Mark

Probably innocuous in the case you show. Your constant "1" is integer(4) (probably 32-bit, depending on your platform). You could change it to 1_2, or, preferably define a parameter constant for this purpose, giving it the value 2 for constants to be used in integer(2) arithmetic. Use of integer(2) is quite rare in the last 15 years in my experience. f77 often refers to use of the obsolete f2c method which translates to C, or it may be (possibly an alias to) another old Fortran compiler, such as g77, which hasn't been maintained for several years. gfortran is the current Fortran compiler companion to gcc.
Tim


--
Tim Prince



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux