facebook / facebook/infer

C wishlist: __attribute__((noreturn))

Open
#136 2 comments 5 reactions 1 assignee Claimed by @dulmarod View on GitHub
c false-positive pinned
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

Seen under Infer 0.2.0 on Ubuntu 14.10 x86_64.

I'm working with code that has its own error handling (e.g. implements its own assert()), and I see a fair number of cases where something like 'assert(p != NULL)' doesn't stop Infer from complaining about a later dereference of p. E.g.:

```
#include

extern void error_path() __attribute__((noreturn));

void f(void)
{
int *p = malloc(sizeof *p);

if (!p)
error_path();

/* This is reported as a NULL_DEREFERENCE,
* although we can't reach here with p == NULL. */
p[0] = 1;

free(p);
}
```

It would be nice to have this Just Work[tm]. :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.