When attempting to compile the recent checkout out of libpfm as an rpm the 
compiler reported the following warning:

gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches 
-pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 
-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 
-fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64   
-mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection 
-fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -O2 
-flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall 
-Wno-complain-wrong-lang -Werror=format-security 
-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS 
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong 
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64   -mtune=generic 
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection 
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -Wall -Werror -Wextra 
-Wno-unused-parameter -I. -I/home/wcohen/rpmbuild/BUILD/libpfm-4.13.0/include 
-DCONFIG_PFMLIB_DEBUG -DCONFIG_PFMLIB_OS_LINUX -DCONFIG_PFMLIB_NOTRACEPOINT -O2 
-flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall 
-Wno-complain-wrong-lang -Werror=format-security 
-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS 
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong 
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64   -mtune=generic 
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection 
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -Wall -Werror -Wextra 
-Wno-unused-parameter -I. 
-I/home/wcohen/rpmbuild/BUILD/libpfm-4.13.0/perf_examples/../include 
-DCONFIG_PFMLIB_DEBUG -DCONFIG_PFMLIB_OS_LINUX -DCONFIG_PFMLIB_NOTRACEPOINT -I. 
-D_GNU_SOURCE -pthread -c task.c
In file included from 
/home/wcohen/rpmbuild/BUILD/libpfm-4.13.0/include/perfmon/pfmlib_perf_event.h:26,
                 from perf_util.h:30,
                 from task.c:36:
In function ‘perf_event_open’,
    inlined from ‘parent’ at task.c:283:15:
/home/wcohen/rpmbuild/BUILD/libpfm-4.13.0/include/perfmon/perf_event.h:604:16: 
error: ‘group_fd’ may be used uninitialized [-Werror=maybe-uninitialized]
  604 |         return syscall(
      |                ^~~~~~~~
  605 |                 __NR_perf_event_open, hw_event_uptr, pid, cpu, 
group_fd, flags);
      |                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
task.c: In function ‘parent’:
task.c:183:47: note: ‘group_fd’ was declared here
  183 |         int status, ret, i, num_fds = 0, grp, group_fd;
      |                                               ^~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** 
[/home/wcohen/rpmbuild/BUILD/libpfm-4.13.0/perf_examples/../rules.mk:30: 
task.o] Error 1
make[1]: Leaving directory 
'/home/wcohen/rpmbuild/BUILD/libpfm-4.13.0/perf_examples'
make[1]: *** Waiting for unfinished jobs....


This appears to to be caused by git commit 
9410619f922facca7dab2406c58fe41a8dd61529

Author: Stephane Eranian <eran...@gmail.com>  2024-02-21 02:22:47
Committer: Stephane Eranian <eran...@gmail.com>  2024-02-28 23:10:14
Parent: 2441b263f6f28c0fe80f8cee62cd2e64d75cd433 (add INTEL_X86_CODE_DUP event 
flag for Intel PMUs)
Child:  e84a9563f4c93dc6e530dfa55d61b150fbf51510 (Add Intel AlderLake 
Goldencove (P-Core) core PMU support)
Branches: master, remotes/origin/master, remotes/upstream/master
Follows: v4.13.0
Precedes: 

    update task.c example to handle hybrid
    
    Cannot group event if they do not belong to the same hardware PMU.
    
    Signed-off-by: Stephane Eranian <eran...@gmail.com>

As a workaround I initialized group_fs = -1 on line 183 of 
perf_examples/task.c.  Is that a sensible solution?

-Will



_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to