From aa3586b855315c9739b5a2de0b54a696521ee2f7 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Mon, 15 Jun 2020 10:42:51 -0700 Subject: [PATCH] document uninit issue Summary: title Reviewed By: ezgicicek Differential Revision: D22045454 fbshipit-source-id: eb3e907d3 --- .../issues/UNINITIALIZED_VALUE.md | 19 +++++++++++++++++++ infer/src/base/IssueType.ml | 5 ++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 infer/documentation/issues/UNINITIALIZED_VALUE.md diff --git a/infer/documentation/issues/UNINITIALIZED_VALUE.md b/infer/documentation/issues/UNINITIALIZED_VALUE.md new file mode 100644 index 000000000..d50d84771 --- /dev/null +++ b/infer/documentation/issues/UNINITIALIZED_VALUE.md @@ -0,0 +1,19 @@ +A value is read before it has been initialized. For example, in C: + +```C +struct coordinates { + int x; + int y; +}; + +void foo() { + struct coordinates c; + c.x = 42; + c.y++; // uninitialized value c.y! + + int z; + if (z == 0) { // uninitialized value z! + // something + } +} +``` diff --git a/infer/src/base/IssueType.ml b/infer/src/base/IssueType.ml index 89726737e..bc15677c4 100644 --- a/infer/src/base/IssueType.ml +++ b/infer/src/base/IssueType.ml @@ -927,7 +927,10 @@ let _unavailable_api_in_supported_ios_sdk = ~user_documentation:[%blob "../../documentation/issues/UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK.md"] -let uninitialized_value = register_from_string ~id:"UNINITIALIZED_VALUE" Error Uninit +let uninitialized_value = + register_from_string ~id:"UNINITIALIZED_VALUE" Error Uninit + ~user_documentation:[%blob "../../documentation/issues/UNINITIALIZED_VALUE.md"] + let unreachable_code_after = register_from_string ~id:"UNREACHABLE_CODE" Error BufferOverrunChecker