facebook / facebook/infer

Why Infer doesn’t find error with LOCK_CONSISTENCY_VIOLATION?

Open
#1,141 6 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

Please make sure your issue is not addressed in the [FAQ](http://fbinfer.com/support.html#troubleshooting).

Please include the following information:
- [v0.17.0 ] The version of infer from `infer --version`.
- [ubuntu14.04 ] Your operating system and version, for example "Debian 9", "MacOS High Sierra", whether you are using Docker, etc.
- [infer -- gcc ] Which command you ran, for example `infer -- make`.
- [ ] The full output in a paste, for instance a [gist](https://gist.github.com/).
- [ok ] If possible, a minimal example to reproduce your problem (for instance, some code where
infer reports incorrectly, together with the way you run infer to reproduce the incorrect
report).

infer version : v0.17.0
OS : ubuntu 14.04

I used command : infer -- gcc -c testcode.c -lpthread
testcode.c is test code including LOCK_CONSISTENCY_VIOLATION error.
but, Infer not found this. ( No issue found )
Why Infer doesn’t find this error?

also, I found infer option " --report-custom-error --developer-mode ".
It can find incorrect Mutex usage.
Where can I find options that aren't in the doc?

Smart guys, please help me.

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#include
#include
#include
#include

pthread_mutex_t mutex_lock;

int g_count = 0;

void *t_function(void *data)
{
int i;
char* thread_name = (char*)data;
// critical section
g_count = 0;
for (i = 0; i < 5; i++)
{
printf("%s COUNT %d\n", thread_name, g_count);
g_count++;
sleep(1);
}
}
int main()
{
pthread_t p_thread1, p_thread2;
int status;
pthread_create(&p_thread1, NULL, t_function, (void *)"Thread1");
pthread_create(&p_thread2, NULL, t_function, (void *)"Thread2");
pthread_join(p_thread1, (void *)&status);
pthread_join(p_thread2, (void *)&status);
}

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported command, `infer -- gcc -c testcode.c -lpthread`, using the supplied pthread test program and Infer v0.17.0 on Ubuntu 14.04. Compare the result with the `--report-custom-error --developer-mode` invocation and consult the available option documentation; done means explaining whether LOCK_CONSISTENCY_VIOLATION should be reported and how the relevant option is supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.