https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120376
Bug ID: 120376
Summary: -fmalloc-dce=0 is not work as expected
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: alexey.lapshin at espressif dot com
Target Milestone: ---
https://godbolt.org/z/9asfj89fr
test app:
// -O2 -fmalloc-dce=0
#include <stdlib.h>
int main() {
if (malloc(16) == 0)
return -1;
return 0;
}
The only way to disable such optimization is to add `-fno-builtin-malloc`,
which seems to me too redundant