https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116570
Bug ID: 116570
Summary: Write without read optimization is not applied to
custom malloc/free even when marked as such
Product: gcc
Version: 13.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: uis9936 at gmail dot com
Target Milestone: ---
Created attachment 59040
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59040&action=edit
Test code
I discovered this by accident when I was testing attributes for custom
allocator.
When I allocate memory with custom allocator with malloc attribute, write to it
and call deallocator that has atteibute access none, the store operation is not
eliminated. But when I do it with regular malloc, then write is eliminated.
See function t in attachment. When regular malloc/free are used, entire
function becomes empty. Compiled with `gcc alloc.c -fanalyzer -Wall -Wextra
-Ofast -S`
Am I missing some attribute?