Why Infer doesn’t find error with LOCK_CONSISTENCY_VIOLATION?
- 主要语言
- OCaml
- 星标
- 15.7k
- 派生
- 2.1k
- 平均合并
- 19 小时 36 分钟
- 30 天内合并 PR
- 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 还没有评估数据。