facebook / facebook/infer

Why Infer doesn’t find error with LOCK_CONSISTENCY_VIOLATION?

Aperta
#1,141 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub
question
Lingua principale
OCaml
Stelle
15.7k
Fork
2.1k
Merge medio
19h 36m
PR unite (30g)
13

Descrizione

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);
}

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.