PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

pgf77: Expansion of variables during compilation.

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
sachin



Joined: 10 Mar 2005
Posts: 3

PostPosted: Tue Mar 15, 2005 5:42 pm    Post subject: pgf77: Expansion of variables during compilation. Reply with quote

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
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6213
Location: The Portland Group Inc.

PostPosted: Wed Mar 16, 2005 11:12 am    Post subject: Reply with quote

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
Back to top
View user's profile
sachin



Joined: 10 Mar 2005
Posts: 3

PostPosted: Wed Mar 16, 2005 11:51 am    Post subject: Reply with quote

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

<PRE>
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
</PRE>

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.
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6213
Location: The Portland Group Inc.

PostPosted: Wed Mar 16, 2005 1:18 pm    Post subject: Reply with quote

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:
Code:
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
Back to top
View user's profile
sachin



Joined: 10 Mar 2005
Posts: 3

PostPosted: Wed Mar 16, 2005 4:10 pm    Post subject: Reply with quote

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`)
Code:

# 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:

Code:

      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
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group