Unable to cast vector to void

Questions on using the PGI Compilers and Tools
nemequ2
Posts: 3
Joined: May 14 2020

Unable to cast vector to void

Post by nemequ2 » Thu May 14, 2020 9:59 am

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).

Code: Select all

#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>.

mkcolg
Posts: 8382
Joined: Jun 30 2004

Re: Unable to cast vector to void

Post by mkcolg » Thu May 14, 2020 10:09 am

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

Code: Select all

% 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

nemequ2
Posts: 3
Joined: May 14 2020

Re: Unable to cast vector to void

Post by nemequ2 » Thu May 14, 2020 10:30 am

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

Code: Select all

"/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…

mkcolg
Posts: 8382
Joined: Jun 30 2004

Re: Unable to cast vector to void

Post by mkcolg » Thu May 14, 2020 12:19 pm

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:

Code: Select all

% 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

nemequ2
Posts: 3
Joined: May 14 2020

Re: Unable to cast vector to void

Post by nemequ2 » Fri May 15, 2020 2:48 pm

mkcolg wrote:
Thu May 14, 2020 12:19 pm
I searched through our issue tracker but don't see any reported issues, nor an ICE, for SIMDe.
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.
mkcolg wrote: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:
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.
mkcolg wrote:Please let me know how to recreate the ICE you're seeing, and I take a look.
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:

Code: Select all

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

Code: Select all

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

Post Reply