Summary: Set arguments of pointer type as initialised for indirect function calls. Reviewed By: mbouaziz Differential Revision: D8097895 fbshipit-source-id: 830f568master
parent
c7c68346c3
commit
c47071f186
@ -0,0 +1,17 @@
|
|||||||
|
# Copyright (c) 2018 - present Facebook, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the BSD style license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
# of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
|
||||||
|
TESTS_DIR = ../../..
|
||||||
|
|
||||||
|
ANALYZER = checkers
|
||||||
|
CLANG_OPTIONS = -c
|
||||||
|
INFER_OPTIONS = -F --project-root $(TESTS_DIR) --uninit-only
|
||||||
|
INFERPRINT_OPTIONS = --issues-tests
|
||||||
|
|
||||||
|
SOURCES = $(wildcard *.c)
|
||||||
|
|
||||||
|
include $(TESTS_DIR)/clang.make
|
@ -0,0 +1 @@
|
|||||||
|
codetoanalyze/c/uninit/uninit.c, dereference_bad, 2, UNINITIALIZED_VALUE, ERROR, []
|
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct A {
|
||||||
|
int field;
|
||||||
|
} B;
|
||||||
|
|
||||||
|
typedef B (*entry_fn)();
|
||||||
|
|
||||||
|
int test_higher_order(entry_fn f) {
|
||||||
|
B event = f();
|
||||||
|
return event.field;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dereference_bad() {
|
||||||
|
int* p;
|
||||||
|
return *p;
|
||||||
|
}
|
Loading…
Reference in new issue