From 1f747d0b14dee0941ef09c50707b7f8c6ce36812 Mon Sep 17 00:00:00 2001 From: Paul Fultz II Date: Mon, 19 Aug 2019 02:09:07 -0500 Subject: [PATCH] Add regression test for 9281 (#2097) --- test/testuninitvar.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 59d87372a..ca9cb8106 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -4047,6 +4047,22 @@ private: " return ostr.str();\n" "}\n"); ASSERT_EQUALS("", errout.str()); + + // #9281 + valueFlowUninit("struct s {\n" + " char a[20];\n" + "};\n" + "void c(struct s *sarg) {\n" + " sarg->a[0] = '\\0';\n" + "}\n" + "void b(struct s *sarg) {\n" + " c(sarg);\n" + "}\n" + "void a() {\n" + " struct s s1;\n" + " b(&s1);\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void uninitvar_memberfunction() {