warning: pointer may be used after ‘realloc’
Status: Beta
Brought to you by:
seranian
gcc 12 now gives this warning on lines 282 and 318 of pfmlib_perf_event_pmu.c which errors out the build due to -Werror. The actual code usage of the reallocated pointer look safe on first glance, so this might be considered as an overly paranoid gcc warning, but it's going to cause compiler failures, regardless. Calculating perf_pe_free - perf_pe before the realloc fixes the problem.
Here's a patch that fixes the problem for me.