-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Closed
Labels
Description
| Bugzilla Link | 2732 |
| Resolution | FIXED |
| Resolved on | Nov 07, 2018 00:21 |
| Version | unspecified |
| OS | All |
| Reporter | LLVM Bugzilla Contributor |
| CC | @tkremenek |
Extended Description
The static analyzer complains if 0 is passed as as numerical argument to a function with attribute((nonnull)). According to both the error message and the GCC function attribute documentation (http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Function-Attributes.html), nonnull only applies to pointer arguments. Test case:
void Callee(int *ip, _Bool f) attribute((nonnull));
void Caller(_Bool f)
{
int x;
if (f) {}; /* [1] Taking false branch. /
Callee(&x, f); / [2] Null pointer (f) passed as an argument to a 'nonnull' parameter */
}
The intention here is, of course, that ip must not be null, but f may be either true or false.