Integer conversion errors with PGI compiler
Status: Beta
Brought to you by:
seranian
I'm able to build Perfmon2 4.11.0 using the PGI 20.9 compiler but I had to change the source code in a lot of places. The particular errors I see are
error: integer conversion resulted in a change of sign
.umask_ovfl_idx = -1,
^
error: integer conversion resulted in a change of sign
return -1;
^
which I believe comes from assigning the negative value to an unsigned integer type and may or may not involve re-sizing the bit-field. The PGI compiler is stricter than the GPU compiler so I expect the code is not compliant with the C/C++ standard in this respect.
I was able to sqelch the error by adding a cast everywhere
= (unsigned long) -1
but you might prefer to make the intent more explicit with something like
#define FULL_MASK 0xFFFFFFFFFFFFFFFFul
.umask_ovfl_idx = FULL_MASK,
return FULL_MASK
These are the line locations I had edited in the file lib/events/perf_events.h :
62
74
83
161
201
236
276
316
346
376
Last edit: Carl Ponder 2020-10-17
Here in lib/pfmlib_perf_event_pmu.c:
388
Here in perf_examples/perf_util.c:
273
283
291
574
There's a short-cast in lib/pfmlib_intel_nhm_unc.c:
This is a little different from the previous, I don't think a casting of (unsigned long) worked in this case. Also my FULL_MASK suggestion probably would have to be defined differently for this case.
Last edit: Carl Ponder 2020-10-18
The file perf_examples/notify_group.c casts the assignement of a function-pointer using it's return-type rather than the parameter list:
The error message it gave was
HI Carl,
Thanks for the bug report.
Could you send me a patch to fix all the PGI compiler warnings. I will apply it.
Thank you.
The original post should have said "GCC compiler" not "GPU compiler". It looks like I don't have the option to edit it in-place.
Here are the files that I'd modified, it looks like I didn't get valid patches to you last fall.
Sorry about that. I uploaded the full files to the bug-report
https://sourceforge.net/p/perfmon2/bugs/11/
Subject: Re: [perfmon2:bugs] #11 Integer conversion errors with PGI
compiler
Date: Thu, 7 Jan 2021 17:31:11 -0800
From: Stephane Eranian eranian@googlemail.com
Reply-To: eranian@gmail.com
To: Carl Ponder CarlPonder@yahoo.com
CC: seranian seranian@users.sourceforge.net, [perfmon2:bugs]
11@bugs.perfmon2.p.re.sourceforge.net
Hi,
Two of the patches you attached are simply removing the files:
perf_util.c and pfmlib_perf_event_pmu.c. Obviously something is wrong there.
Thanks.
On Mon, Oct 19, 2020 at 3:31 PM Carl Ponder <CarlPonder@yahoo.com
CarlPonder@yahoo.com> wrote: