gcc/analyzer/ChangeLog:
PR analyzer/107783
* region-model-impl-calls.cc (kf_accept::matches_call_types_p):
Require that args 1 and 2 be pointers.
(kf_bind::matches_call_types_p): Require that arg 1 be a pointer.
* region-model.h (call_details::arg_is_pointer_p): New
gcc/testsuite/ChangeLog:
PR analyzer/107783
* gcc.dg/analyzer/fd-bind-pr107783.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
bool matches_call_types_p (const call_details &cd) const final override
{
- return cd.num_args () == 3;
+ return (cd.num_args () == 3
+ && cd.arg_is_pointer_p (1)
+ && cd.arg_is_pointer_p (2));
}
void impl_call_post (const call_details &cd) const final override
bool matches_call_types_p (const call_details &cd) const final override
{
- return cd.num_args () == 3;
+ return (cd.num_args () == 3 && cd.arg_is_pointer_p (1));
}
void impl_call_post (const call_details &cd) const final override
bool maybe_set_lhs (const svalue *result) const;
unsigned num_args () const;
+ bool arg_is_pointer_p (unsigned idx) const
+ {
+ return POINTER_TYPE_P (get_arg_type (idx));
+ }
const gcall *get_call_stmt () const { return m_call; }
location_t get_location () const;
--- /dev/null
+int
+foo (void)
+{
+ return bind (0, 0, 0); /* { dg-warning "implicit declaration of function 'bind'" } */
+}