mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Mon Feb 10, 2020 4:39 pm Post subject: Compiler bug with fixed form wide source and continued lines |
|
|
While compiling some old source code in fixed form with many continuation lines and source lines wider than 72 columns, I ran into perplexing responses from FTN95 8.51 (32 and 64 bit). I have prepared a small example to demonstrate the bug.
Code: | subroutine Jacobian_deg(coef)
double precision x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,
1 x15,x16,x17,x18,x19,x20,
2 y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,
3 y15,y16,y17,y18,y19,y20,
4 z1,z2,z3,z4,z5,z6,z7,z8,z9,z10,z11,z12,z13,z14,
5 z15,z16,z17,z18,z19,z20
double precision coef(115)
! code to evaluate x1-x20, y1-y20, z1-z20 removed for brevity
coef(7)= (x1*y10*z11) - (x1*y11*z10) - (x10*y1*z11) + (x10*y11*z1) !only long line in file
1 - (x11*y10*z1) + (x1*y10*z12) - (x1*y12*z10)
2 + (x12*y1*z10) - (x12*y10*z1) + (x1*y10*z13)
3 + (x10*y13*z1) + (x13*y1*z10) - (x13*y10*z1)
4 - (x10*y1*z14) + (x10*y14*z1) + (x14*y1*z10)
5 + (x1*y11*z14) - (x1*y14*z11) + (x1*y15*z10)
6 - (x11*y1*z14) + (x11*y14*z1) + (x14*y1*z11)
7 + (x15*y10*z1) - (x1*y10*z16) + (x1*y16*z10)
8 - (x16*y1*z10) + (x16*y10*z1) + (x1*y13*z14)
9 + (x13*y14*z1) + (x14*y1*z13) - (x14*y13*z1)
1 - (x12*y1*z16) + (x12*y16*z1) + (x16*y1*z12)
2 - (x1*y15*z14) - (x14*y1*z15) + (x14*y15*z1)
3 + (x1*y14*z16) - (x1*y16*z14) - (x14*y1*z16)
4 - (x16*y14*z1) - (x1*y14*z17) + (x1*y17*z14)
5 - (x17*y1*z14) + (x17*y14*z1) + (x1*y14*z18)
6 + (x14*y18*z1) + (x18*y1*z14) - (x18*y14*z1)
7 - (x1*y17*z16) + (x1*y19*z14) + (x14*y1*z19)
8 + (x16*y17*z1) + (x17*y1*z16) - (x17*y16*z1)
9 - (x1*y16*z18) + (x1*y18*z16) + (x16*y1*z18)
1 + (x18*y16*z1) + (x1*y16*z19) - (x1*y19*z16)
2 + (x19*y1*z16) - (x19*y16*z1) - (x10*y11*z12)
3 - (x11*y12*z10) - (x12*y10*z11) + (x12*y11*z10)
4 - (x12*y10*z13) + (x12*y13*z10) + (x13*y10*z12)
end subroutine Jacobian_deg
|
When compiled with ftn95 /error_num /64 /ignore 197 298 c7b.f, a warning is issued for the truncated line. If the /no_truncate option is added, we are told:
Code: | R:\lang\FTN95>ftn95 /no_trunc /error_num /64 /ignore 197 298 c7b.f
[FTN95/x64 Ver. 8.51.0 Copyright (c) Silverfrost Ltd 1993-2019]
0012) coef(7)= (x1*y10*z11) - (x1*y11*z10) - (x10*y1*z11) + (x10*y11*z1) !only long line in file
*** Error 1100: Line is longer than 72 characters (because of /NO_TRUNCATE)
1 ERROR [<JACOBIAN_DEG> FTN95 v8.51.0]
*** Compilation failed |
Gfortran with the -ffixed-line-length-132 option compiles this with no error.
The FTN95 online documentation says that up to 40 continuation lines can be used. I found while working with the larger source code that it accepts many more, but because of the above bug issued many confusing messages if /no_truncate was specified. |
|