This is the mail archive of the gcc-help@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]

How to do this in gfortran


I am porting some very old code. I have many things like below in this code


program test implicit none

       integer*1 ivalx1
       integer*2 ivalx2
       integer*4 ivalx4

       parameter (ivalx1 = x'80')
       parameter (ivalx2 = x'8000')
       parameter (ivalx4 = x'80000000')

The compiler fails with:

f77 test.f
test.f:8.26:

parameter (ivalx1 = x'80')
1
Error: Arithmetic overflow converting INTEGER(8) to INTEGER(1) at (1). This check can be disabled with the option -fno-range-check
test.f:9.26:


parameter (ivalx2 = x'8000')
1
Error: Arithmetic overflow converting INTEGER(8) to INTEGER(2) at (1). This check can be disabled with the option -fno-range-check
test.f:10.26:


parameter (ivalx4 = x'80000000')
1
Error: Arithmetic overflow converting INTEGER(8) to INTEGER(4) at (1). This check can be disabled with the option -fno-range-check


I don't want to use the -fno-range-check option because I want to know about the real ones. I don't understand why gfortran has issues with this. They are certainly valid values for the the types specified. I have been, just setting the values in the code section using the 'transfer' instrinsic but now I'm finding these in include files and I would have to change every source file that used the particular include file. I'm sure there is an easy solution. Could someone enlighten me please.

Thanks and Regards
Mark


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