Unable to cast vector to void

In one of my projects we have to implement an API which takes more parameters than it needs. Depending on the warnings enabled many compilers will warn about the parameters being unused (-Wunused-parameter for GCC/clang, #869 for ICC, #880-D for various TI compilers, etc.), so to silence that I cast the unused parameters to void.

While this works for most types, for x86 vector types (__m128, __m128i, __m256i, etc.) I get a “PGC-S-0094-Illegal type conversion required” error.

Here is a quick test case (the typedef isn’t necessary, just a convenient way to try different types).

#include <immintrin.h>
typedef __m128i foo;

foo bar(foo baz, foo qux) {
  (void) baz;
  return qux;
}

I’ve only been able to test with pgcc (19.10 Community Edition, Linux x86); pgc++ errors on my local system because it can’t find <mm_malloc.h>.

Hi nemequ2,

Can you try using the new pgcc18 C compiler? It’s beta in 19.10 but became our default C compiler in 20.1

% pgcc -c test.c
PGC-S-0094-Illegal type conversion required (test.c: 5)
PGC/x86-64 Linux 19.10-0: compilation completed with severe errors
% pgcc18 -c test.c
%

Though, pgcc18 is really pgc++ in C mode, so exhibit the same issue with mm_malloc but I’m not sure since that seems more likely to be a system issue rather than a PGI compiler issue.

-Mat

Sorry, but not really. Unfortunately I get the same error as with pgc++:

"/opt/pgi/19.10/linux86-64-llvm/19.10/include/edg/xmmintrin.h", line 43:
          catastrophic error: cannot open source file "mm_malloc.h"
  #include <mm_malloc.h>
                        ^

1 catastrophic error detected in the compilation of "p.c".
Compilation terminated.

This is on Fedora 32, so I figured it’s a header problem which will be fixed when a new CE is released.

Just out of curiousity, is there a new C++ compiler to go with it? pgc++ hasn’t been able to build SIMDe for ages (IIRC there was an ICE) and I’d love to get it working again…

Just out of curiousity, is there a new C++ compiler to go with it?

No, just pgcc being pgc++ in C mode.

pgc++ hasn’t been able to build SIMDe for ages (IIRC there was an ICE) and I’d love to get it working again…

I searched through our issue tracker but don’t see any reported issues, nor an ICE, for SIMDe. Though, I do see the following error when I try to compile it with PGI 19.10’s pgcc18 or 20.4’s pgcc:

% pgcc sse3.c -fast -I../../ -c -V20.4
PGC++-S-0076-Initializer not allowed for function (sse3.c: 353)
PGC++-S-0076-Initializer not allowed for function (sse3.c: 353)
PGC++-S-0076-Initializer not allowed for function (sse3.c: 353)
PGC++-S-0076-Initializer not allowed for function (sse3.c: 353)
PGC++-S-0076-Initializer not allowed for function (sse3.c: 353)
PGC++-S-0076-Initializer not allowed for function (sse3.c: 353)
PGC++-S-0076-Initializer not allowed for function (sse3.c: 353)
PGC++-S-0076-Initializer not allowed for function (sse3.c: 353)
PGC++/x86-64 Linux 20.4-0: compilation completed with severe errors

Is thus what you’re seeing? Though, I’m not sure I’m building the test correctly so this could be pilot error.

Please let me know how to recreate the ICE you’re seeing, and I take a look.

-Mat

I reported a bunch of issues a while back, I’m not sure what the status on those is. They probably just don’t mention SIMDe specifically. There is a slightly better-organized version in the SIMDe issue tracker.

I have a few workarounds for PGI in the code, but in C mode PGI generally works for me. I even have a PGI build in CI to keep it that way. C++ is the problem.

Sure. I installed PGI on an Ubuntu 18.04 VM, and was able to reproduce an ICE just by doing mkdir build && cd build && CC=pgcc CXX=pgc++ cmake ../test && make -j.

I decided to run it through C-Reduce, here is what it came up with:

#include <emmintrin.h>
typedef struct { __m64 mmx; } simde_int8x8_t;
int fn1(simde_int8x8_t p1) { return 0; }



nemequ@ubuntu:~$ pgc++ -o pgi-ice pgi-ice.cpp
PGCC-F-0000-Internal compiler error. process_formal_arguments: Function argument with mismatched size that is neither integer nor floating-point       0  (pgi-ice.cpp: 3)
PGCC/x86-64 Linux 19.10-0: compilation aborted

They probably just don’t mention SIMDe specifically.

Yes, that was it. Dave didn’t include the name SIMDe in TPR #24170. Unfortunately, no work has been done on this. I pinged engineering, but with all the other projects they’re working on, this was put as low priority.

and was able to reproduce an ICE just by doing mkdir build && cd build && CC=pgcc CXX=pgc++ cmake ../test && make -j.

Yes, that worked.

I’ve reported the small reproducer as TPR #28482. The same ICE occurs with PGI 20.4 with both pgc++ and pgcc and well as our development nvc++ and nvc compilers. No guarantees this will be given higher priority, but I can ask.

-Mat