Menu

#14 Unspecific casting sigio_handler in examples/notify_group.c

v1.0 (example)
open
nobody
None
5
2022-05-29
2022-05-29
Carl Ponder
No

I'm building the 4.11.1 source using the PGI/NVHPC 22.5 compiler

/work/SHARE/Utils/PGI/22.5/Linux_x86_64/22.5/compilers/bin/pgcc  -Masmkeyword -g -O0 -noswitcherror -m64 -tp=px -D__thread='' -mp -lpthread  -g -Wall -Werror -Wextra -Wno-unused-parameter -I. -I/work/SHARE/Utils/PerfMon2/4.11.1/PGI-22.5/distro/include -DCONFIG_PFMLIB_DEBUG -DCONFIG_PFMLIB_OS_LINUX  -g -Wall -Werror -Wextra -Wno-unused-parameter -I. -I/work/SHARE/Utils/PerfMon2/4.11.1/PGI-22.5/distro/perf_examples/../include -DCONFIG_PFMLIB_DEBUG -DCONFIG_PFMLIB_OS_LINUX -I. -D_GNU_SOURCE -pthread -c notify_group.c

and got this error:

"notify_group.c", line 125: error: a value of type "void *" cannot be assigned to an entity of type "void (*)(int, siginfo_t *, void *)"
    act.sa_sigaction = (void *)sigio_handler;
                     ^

1 error detected in the compilation of "notify_group.c".
make[1]: *** [/work/SHARE/Utils/PerfMon2/4.11.1/PGI-22.5/distro/perf_examples/../rules.mk:30: notify_group.o] Error 2
make[1]: Leaving directory '/work/SHARE/Utils/PerfMon2/4.11.1/PGI-22.5/distro/perf_examples'

I can fix it with the change

125c125
<   act.sa_sigaction = (void *)sigio_handler;
---
>   act.sa_sigaction = (void (*)(int, siginfo_t *, void *))sigio_handler;

correspondent with the recommendation in the error-message.
I know that the PGI compilers are stricter than GCC or Intel in terms of language compliance, and expect this change would work with the other compilers as well.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB