PGC-S-0094 with conformant array parameters

I’m trying to get one of my projects (Squash) working with PGI. One relatively obscure part of C99 we use is conformant array parameters, and pgcc 16.10 has some trouble with it.

The problem occurs when the size parameter is a pointer (i.e., an in/out parameter) and there is a prototype. A quick test case:

#include <string.h>

void clear_buffer (size_t* buffer_size, unsigned char buffer[*buffer_size]);

void
clear_buffer (size_t* buffer_size,
              unsigned char buffer[*buffer_size]) {
  memset(buffer, 0, *buffer_size);
}



$ pgcc -c99 -c -o foo.o foo.c
PGC-S-0094-Illegal type conversion required (foo.c: 7)
PGC/x86-64 Linux 16.10-0: compilation completed with severe errors

Commenting out the prototype gets rid of the errors.

Interestingly, the error comes from the function prototype in Squash, but not the test case. I haven’t been able to produce a test case which reproduces that, but I’m hoping it’s the same issue… if you’d like to test that:

git clone https://github.com/quixdb/squash.git
cd squash
git checkout 969591325b43247774196460ac7970e2e94b7be7
mkdir build && cd build
../autogen.sh CC=pgcc CXX=pgc++
make VERBOSE=1

You should end up with something like

PGC-S-0094-Illegal type conversion required (/home/nemequ/local/src/squash/squash/squash-file.h: 68)
PGC-S-0094-Illegal type conversion required (/home/nemequ/local/src/squash/squash/squash-file.h: 104)
PGC-S-0094-Illegal type conversion required (/home/nemequ/local/src/squash/squash/squash-codec.h: 57)
PGC-S-0094-Illegal type conversion required (/home/nemequ/local/src/squash/squash/squash-codec.h: 60)
PGC-S-0094-Illegal type conversion required (/home/nemequ/local/src/squash/squash/squash-codec.h: 83)
PGC-S-0094-Illegal type conversion required (/home/nemequ/local/src/squash/squash/squash-codec.h: 89)
PGC-S-0094-Illegal type conversion required (/home/nemequ/local/src/squash/squash/squash-codec.h: 95)
PGC-S-0094-Illegal type conversion required (/home/nemequ/local/src/squash/squash/squash-codec.h: 149)
PGC-S-0094-Illegal type conversion required (/home/nemequ/local/src/squash/squash/squash-codec.h: 156)
PGC-S-0094-Illegal type conversion required (/home/nemequ/local/src/squash/squash/squash-codec.h: 164)
PGC-S-0094-Illegal type conversion required (/home/nemequ/local/src/squash/squash/squash-codec.h: 171)
PGC/x86-64 Linux 16.10-0: compilation completed with severe errors

We have replicated your test example, and we have logged the problem as
TPR 23778.

thanks,
dave

I’m not sure about 17.04, but this seems to be fixed in 17.10.

% cat foo.c

#include <string.h> 

 void clear_buffer (size_t* buffer_size, unsigned char buffer[*buffer_size]); 

 void 
 clear_buffer (size_t* buffer_size, 
 unsigned char buffer[*buffer_size]) { 
 memset(buffer, 0, *buffer_size); 
 }

Not working in 17.10 or 18.1
% pgcc -c11 foo.c -c -V

pgcc 18.1-1 64-bit target on x86-64 Linux -tp nehalem
PGI Compilers and Tools
Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
PGC/x86-64 Linux 18.1-1
Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
PGC-S-0094-Illegal type conversion required (foo.c: 7)
PGC/x86-64 Linux 18.1-1: compilation completed with severe errors


danger2% pgcc -c11 foo.c -c -V

pgcc 17.10-0 64-bit target on x86-64 Linux -tp nehalem
PGI Compilers and Tools
Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
PGC/x86-64 Linux 17.10-0
Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
PGC-S-0094-Illegal type conversion required (foo.c: 7)
PGC/x86-64 Linux 17.10-0: compilation completed with severe error

A workaround is to use pgc++

% pgc++ -use-c -c11 -c foo.c -V

pgc++ 17.10-0 64-bit target on x86-64 Linux -tp nehalem
PGI Compilers and Tools
Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
Edison Design Group C/C++ Front End, version 4.13 (Oct 5 2017 15:32:58)
Copyright 1988-2017 Edison Design Group, Inc.

PGCC/x86 Linux 17.10-0
Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.