Building GNU M4 with PGI 16.5 results in warning messages

I was debugging some problems with running make check for the latest version of GNU M4 and noticed that it printed out thousands of lines of warning messages. According to the developers:

"I can reproduce the problem in PGI 16.10 x86-64 by compiling this one-line

short bar = -32768 <= 100000 && 100000 <= 32767 ? (short) 100000 : 0;

Although this is valid C code and is well-defined to initialize ‘bar’ to
0 on x86-64, pgcc warns “Constant value out of range for signed short or
char”. Since the expression “(short) 100000” is not evaluated, the
warning is bogus. Although PGI generates thousands of similar warnings
for test-intprops.c, I expect that they are all bogus and that you can
ignore them. As ‘make check’ does not fail and I don’t see an easy way
to suppress the bogus warnings, I suspect we ought to leave the code alone."

The developers asked me to pass this on to you. Perhaps it is a bug in PGI. GCC does not raise any warning messages for this code snippet.

We recreated the problem and we have logged it as TPR 23757.