pgcc version issue

I’m trying to use pgcc to compile version 1.6 of a code called “Triangle” (which can be downloaded from www.cs.cmu.edu/~quake/triangle.html). The compilation statement I am using is simply

pgcc -c -DLINUX triangle.c

The code fails under 6.0-8, 5.2-4, and 3.2-4 but compiles successfully under pgcc version 6.1-2, so I’m wondering whether this is a compiler problem that was fixed, or whether there is something non-standard here that I need to address.

The error message generated under version 6.0-8 is as follows:

PGC-S-0035-Syntax error: Recovery attempted by replacing ‘:’ by ‘?’ (triangle.c: 4910)
PGC-W-0089-Array name used in logical expression (triangle.c: 4910)
PGC-S-0056-Attempt to call non-function (triangle.c: 4910)
PGC/x86 Linux/x86 6.0-8: compilation completed with severe errors

Line 4910 of triangle.c looks like this:

_FPU_SETCW(cword);

where cword is of type int and was set on the previous line as

cword = 4722;

The function _FPU_SETCW is defined through this statement:

#include <fpu_control.h>

Looking in /usr/include/fpu_control.h, _FPU_SETCW is defined as follows:

#define _FPU_SETCW(cw) asm (“fldcw %0” : : “m” (*&cw))


Anyway, again, I’d be curious to know whether my problem has “disappeared” in pgcc 6.1-2 because of a compiler bug fix or whether there is something non-standard in the code that I can address.

Thanks,
David

Hi David,

Extended ASM is a non-standard GNU extension that PGI began adding support for in the 6.1 release of pgcc. For earlier PGI releases, you would need an alternate version for _FPU_SETCW or use gcc for this particular file.

Hope this clarifies things!
Mat

Very helpful! Thank you.

Now … Is there a clever, robust way to determine during compilation (e.g. in a Makefile or configure script) whether the pgcc version is recent enough?

Hi David,

As of the 6.1-5 version of pgcc, we added the following macros:

PGIC major release number
PGIC_MINOR minor release number
PGIC_PATCHLEVEL patch version

% cat version.c
#include <stdio.h>
int main() {

  printf("%d.%d-%d\n", __PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__);
  exit(0);
}
% pgcc -V6.2 version.c
% a.out
6.2-3

Hope this helps,
Mat