facebook / facebook/infer

Why Infer doesn’t find error with LOCK_CONSISTENCY_VIOLATION?

オープン
#1,141 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
question
主要言語
OCaml
スター
15.7k
フォーク
2.1k
平均マージ
19時間 36分
マージ済み PR(30日)
13

説明

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。