[Bug analyzer/104860] New: RFE: -Wanalyzer-possible-null-argument and -Wanalyzer-null-argument should respect __attribute__((access, ...))
dmalcolm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 9 20:18:02 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104860
Bug ID: 104860
Summary: RFE: -Wanalyzer-possible-null-argument and
-Wanalyzer-null-argument should respect
__attribute__((access, ...))
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: dmalcolm at gcc dot gnu.org
Target Milestone: ---
Similar to PR analyzer/104793, but relating to NULL/possibly NULL pointers (and
affects reads as well as writes):
typedef __SIZE_TYPE__ size_t;
int getrandom (void *__buffer, size_t __length,
unsigned int __flags)
__attribute__ ((access (__write_only__, 1, 2)));
#define GRND_RANDOM 0x02
void test (int flag)
{
char *buf = __builtin_malloc (1024);
if (getrandom(buf, 16, GRND_RANDOM))
__builtin_printf("%s\n", buf);
__builtin_free (buf);
}
The call to malloc could fail, but we don't yet complain about the
possibly-NULL param to getrandom, that's marked with __attribute__ ((access,
...))
More information about the Gcc-bugs
mailing list