public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "eggert at cs dot ucla.edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/101829] New: problems with inline + __attribute__ ((malloc (deallocator))) Date: Mon, 09 Aug 2021 10:33:59 +0000 [thread overview] Message-ID: <bug-101829-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101829 Bug ID: 101829 Summary: problems with inline + __attribute__ ((malloc (deallocator))) Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: eggert at cs dot ucla.edu Target Milestone: --- We've recently started using __attribute__ ((malloc (deallocator))) with Gnulib and ran into the problem that the GCC documentation in doc/extend.texi says this: "Since inlining one of the associated functions but not the other could result in apparent mismatches, this form of attribute @code{malloc} is not accepted on inline functions." This has caused problems for us, as many of our functions are naturally inline and are allocators or deallocators. As Bruno Haible wrote in <https://lists.gnu.org/r/bug-gnulib/2021-08/msg00092.html>: "The GCC documentation [1] says that the attribute 'malloc (deallocator, 1)' does not work on inline functions. IMO, this restriction is not tenable in the long run (because the semantics of a function don't depend on whether it is inline or not, and because in C++ the majority of all functions is inline)." We have resorted to merely adding comments to the functions in question. It would be better if we could add the attributes, and then GCC can ignore them when applied to inline functions. Alternatively, GCC could refuse to inline such functions. Either would be preferable to the current situation.
next reply other threads:[~2021-08-09 10:34 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-09 10:33 eggert at cs dot ucla.edu [this message] 2021-08-09 12:52 ` [Bug middle-end/101829] " rguenth at gcc dot gnu.org 2021-08-09 15:58 ` hubicka at ucw dot cz 2021-08-12 20:32 ` msebor at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-101829-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).