Several issues with pgcc on Windows

I gave PGI Community Edition Version 17.4 for Windows x64 a try and experience several issues with code which compiles well on Linux. The environment is:

  • Windows 10 Pro, Version 1607, 64-bit operatins system, x64-based processor
  • Windows Software Development Kit - Windows 10.0.15063.13
  • Microsoft Visual Studio Community 2015 Version 14.0.25431.01 Update 3
  • pgcc 17.4-0 64-bit target on x86-64 Windows -tp haswell

Firstly isnan does not compile:

// test1.c
#include <math.h>
int main(void)
{
    isnan(0.0);
}



PGI$ pgcc test1.c
PGC-S-0036-Syntax error: Recovery attempted by inserting ‘?’ before ‘:’ (test1.c: 5)
PGC-S-0039-Use of undeclared variable suppress (test1.c: 5)
PGC-S-0056-Attempt to call non-function (test1.c: 5)
PGC-S-0036-Syntax error: Recovery attempted by inserting ‘?’ before ‘:’ (test1.c: 5)
PGC-S-0056-Attempt to call non-function (test1.c: 5)
PGC/x86-64 Windows 17.4-0: compilation completed with severe errors

Then ULONG_MAX can’t be compared with ULLONG_MAX:

// test2.c
#include <limits.h>
int main(void)
{
#if ULONG_MAX == ULLONG_MAX
#endif
}



PGI$ pgcc test2.c
PGC-S-0027-Illegal integer constant: ffffffffffffffffui64 (test2.c: 5)
PGC-S-0254-Illegal number in directive (test2.c: 5)
PGC/x86-64 Windows 17.4-0: compilation completed with severe errors

The following fragment links on Linux but not on Windows:

// test3.h
inline int add(int a, int b);
static inline int add(int a, int b)
{
	return a + b;
}

// test3a.c
#include "test3.h"
int sub(int a, int b)
{
   add(a, -b);
}

// test3.c
#include "test4.h"
int main(void)
{
   add(1, 2);
}



PGI$ pgcc -c test3a.c
PGI$ pgcc test3a.obj test3.c
test3.c:
test3.obj : error LNK2005: add already defined in test3a.obj
test3a.exe : fatal error LNK1169: one or more multiply defined symbols found

Since gcc emits a warning:

$ gcc -std=c11 -c test3a.c -o test3a.o
In file included from test3a.c:1:0:
test3.h:1:12: warning: inline function ‘add’ declared but never defined
inline int add(int a, int b);
^
$ gcc -std=c11 test3a.o test3.c -o test3
In file included from test3.c:1:0:
test3.h:1:12: warning: inline function ‘add’ declared but never defined
inline int add(int a, int b);
^

I think the code is not conform to C11. Nevertheless it runs on Linux.

Then some header files produce warnings:

// test4.c
#include <inttypes.h>
int main(void)
{
}



PGI$ pgcc test.c
PGC-W-0114-More than one type specified (C:\PROGRA~1\PGICE/win64/17.4/include/vcruntime.h: 220)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:\PROGRA~1\PGICE/win64/17.4/include/vcruntime.h: 220)
PGC/x86-64 Windows 17.4-0: compilation completed with warnings


// test5.c
#include <windows.h>
int main(void)
{
}



PGI$ pgcc test2.c
PGC-W-0114-More than one type specified (C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um\commdlg.h: 729)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um\commdlg.h: 729)
PGC-W-0043-Redefinition of symbol, LPUINT (C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um\imm.h: 45)
PGC/x86-64 Windows 17.4-0: compilation completed with warnings

And finally there is an issue with OpenCL:

// test6.c
#include <CL/cl.h>
int main(void)
{
}



PGI$ pgcc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" test6.c
PGC-W-0267-#warning – Need to implement some method to align data here (C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include\CL/cl_platform.h: 482)
PGC-W-0114-More than one type specified (C:\PROGRA~1\PGICE/win64/17.4/include/vcruntime.h: 220)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:\PROGRA~1\PGICE/win64/17.4/include/vcruntime.h: 220)
PGC/x86-64 Windows 17.4-0: compilation completed with warnings

PGC-W-0114, PGC-W-0143 are Windows specific but PGC-W-0267 remains on Linux.

I wonder:

  • How can I fix test1.c and test2.c?
  • Can the header warning be safely ignored? Can they be avoided?
  • Can the OpenCL warning be ignored, too?

Hello,

Here is the results of your issues.

  1. program with math.h causes severe errors
    Logged as TPR 24318 - I have requested a workaround.

  2. ULONG_MAX vs ULLONG_MAX failure
    Logged as TPR 24319 - I have asked for a Workaround.

  3. Link error with multiple defs.
    logged as TPR 24320

  4. Warnings from header <inttypes.h>
    Logged as TPR 24321 - I have requested to know if the warnings
    can be ignored or worked around.

  5. Warnings from header <windows.h>
    Logged as TPR 24322 - I have requested whether the warnings
    can be ignored or workaround.

  6. Warnings from OpenCL header.
    Logged as TPR 24323 - I have asked if the warnings can be ignored
    or worked around.

Many thanks for the fast reply, jtull. Is there a way to track the status of the TPRs for users of the community edition?

Problem 3 ( TPR 24320) is user error.

// test3.h
inline int add(int a, int b);
static inline int add(int a, int b)
{
return a + b;
}

should be

// test3.h
static inline int add(int a, int b);
static inline int add(int a, int b)
{
return a + b;
}

and program links without issue.

Yes, jtull, to observe the standard is the fix but not the point. I said: runs under Linux, does not link under Windows. If “runs under Linux as well as under Windows” is not your design goal then this is no issue.

Hi phi-psi,

Did you try pgCC C++ compilers under windows? I cannot seem to get it to work and have no idea what the issue is?

Ruth

PGI stopped providing pgCC/pgcpp on Windows at the beginning
of 2016. There is no PGI C++ compiler on Windows.

dave

An update.


//test5.c
#include <windows.h>
int main(void)
{
}

pgcc -c -DWIN32_MEAN_AND_LEAN test5.c

compiles.

24320 - Windows C (Prob 3) Link Failure with multiple defs

has been corrected in the current 17.10 release.

dave

I am also interested in TPR 24321, related to warnings from the header (test4). As phi-psi asked, is there a way to track the status of the TPRs? If not, is there an estimation of when these warnings (ultimately from vcruntime.h) will be fixed? Thanks in advance!

No new status for TPR 24321. Our bug tracking system is not equipped
for user viewing, as we do not separate comments only engineering should see from ones the public can see.

dave

Thanks for the quick reply!