LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 52265 - __attribute__((malloc)) with arguments
Summary: __attribute__((malloc)) with arguments
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: -New Bugs (show other bugs)
Version: trunk
Hardware: All All
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-22 10:02 PDT by Brad King
Modified: 2021-10-22 10:06 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brad King 2021-10-22 10:02:05 PDT
GCC 11.x added support for arguments to __attribute__ (malloc):

* https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;f=gcc/doc/extend.texi;h=dce6c58db87ebf7f4477bd3126228e73e4eeee97#patch6

For example:

$ cat test.c
typedef struct my_s {} my;
void myclose (my*);
__attribute__ ((malloc, malloc (myclose))) my* myopen(void);


$ gcc-11 -c test.c
(works)

$ clang-13 -c test.c
test.c:3:25: error: 'malloc' attribute takes no arguments
__attribute__ ((malloc, malloc (myclose))) my* myopen(void);
                        ^