pgf77: Expansion of variables during compilation.

Hi,

I came across this issue when compiling my Fortran77 code. I don’t have any source line close to being 72 columns wide. But I get a compilation error.

myneni@ca-amd01 p4/os > pgf77 -g -c test.F
PGFTN-S-0066-Too few data constants in initialization statement (test.F: 45)
0 inform, 0 warnings, 1 severes, 0 fatal for respnmes

C…BEGIN …SOURCE…
myneni@ca-amd01 p4/os > cat test.F
block data respnmes
implicit none

#define RESVALS_OWNER

#ifndef RESPTYPE_H
#define RESPTYPE_H

#define IR1_equa_wcomp -1
#define IR1_equa_wfreq -2
#define IR1_equa_comb -3

#define IR_mass 1
#define IR_massfrac 2
#define IR_volume 3
#define IR_volfrac 4
#define IR_freq 5
#define IR_buck 6
#define IR_comp 7
#define IR_disp 8
#define IR_stress 9
#define IR_strain 10
#define IR_force 11
#define IR_cstrain 12
#define IR_cstress 13
#define IR_cfailure 14
#define IR_cog 15
#define IR_inertia 16
#define IR_equa 17
#define IR_external 18

#endif

#define NRESNAMES 22
integer respval(NRESNAMES)

common /resvals/ respval

data respval / IR_mass, IR_mass, IR_volume, IR_volfrac,
$ IR_buck, IR_buck, IR_buck, IR_freq, IR_comp, IR_disp,
$ IR_stress, IR_strain, IR_cog, IR_inertia, IR_force,
$ IR_cstress, IR_cfailure, IR1_equa_wcomp, IR1_equa_wfreq,
$ IR1_equa_comb, IR_equa, IR_external /
end
C…END … SOURCE…


I am using 5.2-4 which I downloaded for evaluation.

I would appreciate help / comments on this issue. I tried using ‘-Mextend’ option but that messes up the compilation of some 3rd party libraries that contains tons of Hollerith constants in the format statements that extend beyond a single line…well, that’s for another post.

Thanks!!
-Sachin

Hi Sachin,

When I compile this code as you have it below I do get errors. The errors are different than what you get but may be caused by the same thing. Try indenting your code to the 7th column (the directives can be in the 1st column). When indented, the code compiled fine for me.

Hope this helps,
Mat

Mat,

I do indent my code to the 7th column, with the 6th column being used for the continuation character. What error did you get?


Here is the code again with the column numbering and the error message (tried to format it properly using the ‘PRE’ HTML statement:).

Thanks!
-Sachin

block data respnmes
implicit none

#define RESVALS_OWNER

#ifndef RESPTYPE_H
#define RESPTYPE_H

#define DI_nr0typ  15

#define DI_nr1typ  30

#define IR1_equa_wcomp    -1
#define IR1_equa_wfreq    -2
#define IR1_equa_comb     -3

#define DI_nrtype  18

#define IR_mass          1
#define IR_massfrac      2
#define IR_volume        3
#define IR_volfrac       4
#define IR_freq          5
#define IR_buck          6
#define IR_comp          7
#define IR_disp          8
#define IR_stress        9
#define IR_strain       10
#define IR_force        11
#define IR_cstrain      12
#define IR_cstress      13
#define IR_cfailure     14
#define IR_cog          15
#define IR_inertia      16
#define IR_equa         17
#define IR_external     18

#endif

#define NRESNAMES 22
integer respval(NRESNAMES)

common /resvals/ respval

C        1         2         3         4         5         6         7
C234567890123456789012345678901234567890123456789012345678901234567890
data respval / IR_mass, IR_mass, IR_volume, IR_volfrac,
$   IR_buck, IR_buck, IR_buck, IR_freq, IR_comp, IR_disp,
$   IR_stress, IR_strain, IR_cog, IR_inertia, IR_force,
$   IR_cstress, IR_cfailure, IR1_equa_wcomp, IR1_equa_wfreq,
$   IR1_equa_comb, IR_equa, IR_external /
end

PGFTN-S-0066-Too few data constants in initialization statement (test.F: 47)
0 inform, 0 warnings, 1 severes, 0 fatal for respnmes
myneni@ca-amd01 p4/os >

Line#47 corresponds to the data statement.

Hi sachin,

It works fine for me. In your second post, there seems to be a lot of extra space. I don’t know if this is part of the file or just a consequence of your cut and paste. (FYI you can use user forum’s “code” tags to get things formatted nicely)

Here’s a log of my compilation:

xflag:/tmp% cat test.F
      block data respnmes
      implicit none

#define RESVALS_OWNER

#ifndef RESPTYPE_H
#define RESPTYPE_H

#define IR1_equa_wcomp -1
#define IR1_equa_wfreq -2
#define IR1_equa_comb -3

#define IR_mass 1
#define IR_massfrac 2
#define IR_volume 3
#define IR_volfrac 4
#define IR_freq 5
#define IR_buck 6
#define IR_comp 7
#define IR_disp 8
#define IR_stress 9
#define IR_strain 10
#define IR_force 11
#define IR_cstrain 12
#define IR_cstress 13
#define IR_cfailure 14
#define IR_cog 15
#define IR_inertia 16
#define IR_equa 17
#define IR_external 18

#endif

#define NRESNAMES 22
      integer respval(NRESNAMES)

      common /resvals/ respval

      data respval / IR_mass, IR_mass, IR_volume, IR_volfrac,
     $     IR_buck, IR_buck, IR_buck, IR_freq, IR_comp, IR_disp,
     $     IR_stress, IR_strain, IR_cog, IR_inertia, IR_force,
     $     IR_cstress, IR_cfailure, IR1_equa_wcomp, IR1_equa_wfreq,
     $     IR1_equa_comb, IR_equa, IR_external /
      end
xflag:/tmp% pgf77 -g -c -V test.F

pgf77 5.2-4
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2004, STMicroelectronics, Inc.  All Rights Reserved.
PGFTN/x86 Linux/x86 5.2-4
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2004, STMicroelectronics, Inc.  All Rights Reserved.
xflag:/tmp% ls
test.F  test.o
  • Mat

Thanks Mat. I will use code tags for future postings.

I am not sure how it worked for you and doesn’t work for me. I also asked a PGI support person and he pointed out that pgf77 preprocesses differently than CPP.

The following is the output from CPP preprocessing: (cpp test.F test.f)

# 1 "test.F"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.F"
      block data respnmes
      implicit none
# 41 "test.F"
      integer respval(22)

      common /resvals/ respval

C 1 2 3 4 5 6 7
C234567890123456789012345678901234567890123456789012345678901234567890
      data respval / 1, 1, 3, 4,
     $ 6, 6, 6, 5, 7, 8,
     $ 9, 10, 15, 16, 11,
     $ 13, 14, -1, -2,
     $ -3, 17, 18 /
      end
myneni@ca-amd01 p4/os >

The following is the output of preprocessing through pgf77:

      block data respnmes
      implicit none









      integer respval(22)

      common /resvals/ respval

C        1         2         3         4         5         6         7
C234567890123456789012345678901234567890123456789012345678901234567890
      data respval /          1,          1,        3,       4,
     $            6,          6,          6,          5,          7,          8,
     $          9,       10,          15,      16,        11,
     $        13,     14,    -1,    -2,
     $       -3,         17,     18 /
      end

myneni@ca-amd01 p4/os >

Anyway…I think I found the answer.
Thanks for your help.

-Sachin