This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/80378] Extend alloc_size attribute for better Linux kernel checking
- From: "amonakov at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 24 Apr 2017 15:16:08 +0000
- Subject: [Bug c/80378] Extend alloc_size attribute for better Linux kernel checking
- Auto-submitted: auto-generated
- References: <bug-80378-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80378
--- Comment #7 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
This sounds like a separate problem that is solvable via __builtin_constant_p?
For example:
void link_error(void) __attribute__((error("size check failed")));
if (__builtin_constant_p(size) && size-0ul >= MAX_ALLOC_SIZE)
link_error();