PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Internal Compiler Error using const variable in array def.

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



Joined: 03 Apr 2012
Posts: 1

PostPosted: Tue Apr 03, 2012 10:25 am    Post subject: Internal Compiler Error using const variable in array def. Reply with quote

Hi guys,

I think there is an error with PGI C compiler because I am not able to use a const sized array without the compiler showing some message concerning the symbol table being referenced.

The error however is misleading because it can jump at any line, although the executable program is behaving correctly.

My code looks like follows:

Code:

MPI_Datatype create_custom_type () {
   const int blocks = 2; // a block of floats, followed by a block of ints
   MPI_Datatype types[blocks]={MPI_FLOAT, MPI_INT};
   int lengths[blocks]={2,4};
   MPI_Aint offsets[blocks];
   MPI_Datatype newtype;
   MPI_Aint sizeoffloat;
        MPI_Type_extent(MPI_FLOAT, &sizeoffloat);
   offsets[0] = (MPI_Aint) 0;
   offsets[1] = 2*sizeoffloat;
   MPI_Type_struct(blocks, lengths, offsets, types, &newtype);
   return newtype;
}//create_custom_type()


The error message I get from the compiler is:

Code:

PGC-S-0000-Internal compiler error. sym_is_refd: bad sc for    2011


which as you can see is very cryptic. The work around is hardcoding the size of the array when is declared. Still I believe declaring the array size as const should do it.

Anyone else have found this problem when declaring arrays with const sized variables?
--
Omar V.M.
Back to top
View user's profile
mkcolg



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

PostPosted: Tue Apr 03, 2012 10:46 am    Post subject: Reply with quote

Hi Omar,

The compiler ICE (TPR#17864) was fixed in the 11.7 compilers. Now your code will produce the following syntax error:
Quote:
% pgcc -c mpit.c -V11.7 -I/usr/pgi/linux86-64/2011/mpi2/mpich/include/
PGC-S-0169-Variable-sized object, types, cannot be initialized (mpit.c: 5)
PGC-S-0169-Variable-sized object, lengths, cannot be initialized (mpit.c: 6)
PGC/x86-64 Linux 11.7-1: compilation completed with severe errors
Although "blocks" has the "const" qualifier, "types" and "lengths" are still VLAs and can not be initialized. You must either declare these arrays as being fixed size or separate the initialization from the declaration.

Best Regards,
Mat
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