https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111135
Bug ID: 111135
Summary: Add ECF_MALLOC for BUILT_IN_GOMP_ALLOC
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
The Fortran side is all in gcc/fortran/f95-lang.cc
It seems as if ECF_MALLOC should be added to
ATTR_ALLOC_WARN_UNUSED_RESULT_SIZE_2_NOTHROW_LIST
to match both builtin-attrs.def; that macro is used for:
BUILT_IN_ALIGNED_ALLOC
BUILT_IN_GOMP_ALLOC
(I find the builtin-attrs.def file not very readable.)
I do note that f95-lang.cc has:
DECL_IS_MALLOC (builtin_decl_explicit (BUILT_IN_CALLOC)) = 1;
while builtins.def uses
ATTR_MALLOC_WARN_UNUSED_RESULT_SIZE_1_2_NOTHROW_LEAF_LIST
for it.
Thus, setting DECL_IS_MALLOC for GOMP_ALLOC explicitly would work as well
(ALIGNED_ALLOC is not (yet) used in the Fortran FE.)
BTW: The ECF_MALLOC causes DECL_IS_MALLOC to be set via tree.cc's
set_call_expr_flags.