0
votes

I have the following subroutine, which compiles using the intel fortran compiler but does not compile using gfortran. This is the subroutine code:

subroutine makepar
!----------------------------------------------------------------------
!                       WRITE A PARAMETER FILE                         
!----------------------------------------------------------------------
    integer, parameter :: lun=99
    open(lun,file='pixelplt2008.par',status='UNKNOWN')
    write(lun,10)
10  format(  &
    '',/, &
    '',/, &
    '                  Parameters for PIXELPLT2008',/, &
    '                  ***********************',/, &
    '',/, &
    'START OF PARAMETERS:',/, &
    'kb2d.out              -file with gridded data',/, &
    '1                     -column number for variable',/, &
    '-998  1.0e21          -data trimming limits',/, &
    'data.out              -file with data to plot',/, &
    '0 2 3 4 5 8.0         -columns for point id or label, x,y,z coords, variable, symbol size',/, &
    '0 10000               -xmin, xmax limits to plot if no grid file is plotted (limits taken from grid if a grid is plotted)',/, &
    '0 10000               -ymin, ymax limits to plot if no grid file is plotted (limits taken from grid if a grid is plotted)',/, &
    'poly.out              -file containing a polygon to trim grid within (data are not trimmed)',/, &
    '1 2 1 3.0             -columns for x and y coords, plot option (1=yes), lineweight for polygon',/, &
    '0 0 0.0 0.0 0 0       -background grid x and y spacing (0=dont plot the background grid), start x and y, azimuth, ticks around plot (1=yes)',/, &
    'pixelplt.ps           -file with PostScript output',/, &
    '1                     -realization number',/, &
    '100   50   100        -nx,xmn,xsiz',/, &
    '100   50   100        -ny,ymn,ysiz',/, &
    '1   .5   1            -nz, zmn, zsiz',/, &
    '1                     -vertical exageration (1=no exageration)',/, &
    '1                     -slice orientation: 1=XY, 2=XZ, 3=YZ  (set to -1,-2 or -3 to skip drawing the color bar)',/, &
    '1 -1.3                -slice number,tol: point data require a tol (i.e. plot +/- 1.3m from the center of the plotted slice) neg=plot all points',/, &
    'Porosity Well Data    -title ',/, &
    'East                  -X label',/, &
    'North                 -Y label',/, &
    '0                     -brightness of background(0=no change, 1=very bright, -1=very dark)',/, &
    '0                     -0=arithmetic, 1=log scaling',/, &
    '',/, &
    '',/, &
    'COLORBAR JET 2 16 5   -COLORBAR, keyword, type, min, max, number of labels (See below for how to plot custom or categorical)',/, &
    '0 0 0                 -rotate color bar (1=yes), xpos, ypos of color bar (+/- from the default positions)',/, &
    '0 3                   -type: 0=continuous 1=categorical, #of steps (type COLORBAR CUSTOM 5 above to use categorical or custom color bar)',/, &
    '7  2  Low             -colorcode, value OR category, label',/, &
    '9  8  Mid             -colorcode, value OR category, label',/, &
    '1  16 High            -colorcode, value OR category, label',/, &
    '',/, &
    '----------------------------------------------------------------------------',/, &
    '-EVERYTHING BELOW THIS LINE CAN BE REMOVED TO MAKE THE PAR FILE SHORTER!!!!!',/, &
    '----------------------------------------------------------------------------',/, &
    '',/, &
    'ADVANCED OPTIONS:  Dont change if you want to ignore',/, &
    '',/, &
    'CHANGE SHAPE OF DATA',/, &
    '1                        -0=use shape file, 1=all points plotted as circles, 2=squares, 3=triangles',/, &
    'data.out                 -file with indicators for which data are plotted as (circles 1, squares 2, triangles 3)',/, &
    '11                       -column for the indicators',/, &
    '0                        -plot a legend for these shapes (1=yes)',/, &
    '0 0                      -xpos, ypos of legend (+/- from the default position which is directly below the color bar)',/, &
    '1 0 1                    -include the circles, squares, triangels in the legend? (1=yes)',/, &
    'Well Data                -label for the circles',/, &
    'none                     -label for the squares',/, &
    'Clustered Data           -label for the triangles',/, &
    '',/, &
    'ADDITIONAL FILE:',/, &
    '0                        -option to paste a background grid from another file (1=yes)',/, &
    'outline.ps               -will write this file out on top of the grid, but below the data',/, &
    '',/, &
    '',/, &
    '--------------------------------------------------------------------------------------------------------------------',/, &
    '--------------------------------------------------------------------------------------------------------------------',/, &
    'Color Codes Plotting:',/, &
    '      1=red, 2=orange, 3=yellow, 4=light green, 5=green, 6=light blue,',/, &
    '      7=dark blue, 8=violet, 9=white, 10=black, 11=purple, 12=brown,',/, &
    '      13=pink, 14=intermediate green, 15=gray',/, &
    '',/, &
    'Colorbar usage',/, &
    '  Built in types specify: COLORBAR TYPE MIN MAX  NUMBER Of LABELS',/, &
    '  TYPE: HOT, JET, HSV, GRAY, COPPER, PINK',/, &
    '',/, &
    '  To use a custom color bar specify: COLORBAR CUSTOM NUMBER OF LABELS  and specify continous cutoffs below',/, &
    '  To use a categorical color bar specify: COLORBAR CUSTOM NUMBER OF LABELS  and specify categories below',/, &
    '',/, &
    '',/, &
    'Polygon',/, &
    '',/, &
    '  Trimming: if a polygon is input, the pixelplt will be trimmed inside it.',/, &
    '  Plot option: If set to 1, the trimming polygon will be plotted.',/, &
    '  Lineweight: light (1.0) to heavy (6.0)',/, &
    '  Set one of the column numbers to zero for no polygon or input a data file',/, &
    '    that does not exist.',/, &
    '',/, &
    'Background Grid',/, &
    '  Start Position: If no start x,y position, the grid defaults to the minimum of the pixelplt.',/, &
    '  Azimuth: Align the grid along an input azimuth angle in degrees',/, &
    '  Set spacing to zero for no background grid.',/, &
    '',/, &
    'Brightness Scaling',/, &
    '  May get an artifact if color is completly black',/, &
    '  Data that are overlayed on the background map are not dimmed or brightened so that they',/, &
    '  stand out over the background.',/, &
    '',/, &
    '',/, &
    '',/, &
    '',/, &
    '',/, &
    '',/, &
    '',/, &
    '',/)

    close(lun)
end subroutine makepar

This code gives me the following errors:

 In file pixelplt2008.f90:1330

ound
    1
Error: Unexpected end of format string in format string at (1)
 In file pixelplt2008.f90:1331

    'pixelplt.ps           -file with PostScript output',/, &
   1
Error: Unclassifiable statement at (1)
 In file pixelplt2008.f90:1339

    'Porosity Well Data    -title ',/, &
   1
Error: Unclassifiable statement at (1)
 In file pixelplt2008.f90:1347

    '0 0 0                 -rotate color bar (1=yes), xpos, ypos of color bar (
   1
Error: Unclassifiable statement at (1)
 In file pixelplt2008.f90:1349

    '7  2  Low             -colorcode, value OR category, label',/, &
   1
Error: Unclassifiable statement at (1)
 In file pixelplt2008.f90:1313

    write(lun,10)
               1
Error: FORMAT label 10 at (1) not defined

Any ideas how I can get it to compile with gfortran?

1

1 Answers

3
votes

A line in a standard conforming program can have a maximum of 132 characters in free source form. The first error points to a line with a longer length (I didn't look past this first error). The line gets cut off at that point and then the statement makes no more sense.

Apparently Intel Fortran by default accepts programs that are non-conforming in this way, while gfortran by default adheres to the standard line-length. You can get gfortran to accept longer lines with the option -ffree-line-length-n. From the manual:

-ffree-line-length-n

Set column after which characters are ignored in typical free-form lines in the source file. The default value is 132. n may be ‘none’, meaning that the entire line is meaningful. -ffree-line-length-0 means the same thing as -ffree-line-length-none.