https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125073
Bug ID: 125073
Summary: Bogus mismatched-dealloc warning
Product: gcc
Version: 15.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: andres at anarazel dot de
Target Milestone: ---
Created attachment 64307
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64307&action=edit
repro
Hi,
In the attached, heavily minimized, reproducer gcc claims there's a deallocator
mismatch:
gcc-12 -O0 -Wmismatched-dealloc test.c -c
test.c: In function ‘pgpa_plan_walker’:
test.c:15:13: warning: ‘lappend’ called on pointer ‘flat_relids’ passed to
mismatched allocation function ‘bms_add_member’ [-Wmismatched-dealloc]
15 | l = lappend(l, flat_relids);
| ^~~~~~~~~~~~~~~~~~~~~~~
test.c:14:31: note: call to ‘bms_add_member’
14 | flat_relids = bms_add_member(flat_relids, 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
However that's bogus, because lappend is marked as a deallocator on argument 1,
not argument 2.
Curiously the for loop seems to be required for this, despite the loop only
having a trip count of 1.
The warning reproduces from 12 to HEAD.
A, potentially separate, issue is that the same warning is printed twice. This
started with gcc 13.
Greetings,
Andres