From 4a013f5bf67ab99b8318b326cf23c65574a9c740 Mon Sep 17 00:00:00 2001 From: Sungkeun Cho Date: Mon, 4 Mar 2019 18:58:35 -0800 Subject: [PATCH] [inferbo] Add FN test of using global constant Summary: After a redeclaration of a global constant, it is not parsed as ICE(integral constant expression), which results in FN. Reviewed By: ezgicicek Differential Revision: D14299288 fbshipit-source-id: 394afd595 --- .../tests/codetoanalyze/cpp/bufferoverrun/class.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/infer/tests/codetoanalyze/cpp/bufferoverrun/class.cpp b/infer/tests/codetoanalyze/cpp/bufferoverrun/class.cpp index a45c2d5ee..c0a4e6e19 100644 --- a/infer/tests/codetoanalyze/cpp/bufferoverrun/class.cpp +++ b/infer/tests/codetoanalyze/cpp/bufferoverrun/class.cpp @@ -291,6 +291,18 @@ void use_global_Bad() { a[S::x] = 0; } +const unsigned int S::x; + +void use_global_2_Good() { + int a[50]; + a[S::x] = 0; +} + +void use_global_2_Bad_FN() { + int a[30]; + a[S::x] = 0; +} + class my_class6 { int* x;