diff --git a/lib/executionpath.cpp b/lib/executionpath.cpp index 5437c5e58..abaab0a2c 100644 --- a/lib/executionpath.cpp +++ b/lib/executionpath.cpp @@ -149,6 +149,13 @@ static const Token *checkExecutionPaths_(const Token *tok, std::listtokAt(2), ". %var% =")) + { + ExecutionPath::bailOut(checks); + return 0; + } + tok = tok->next()->link(); if (!tok) { diff --git a/test/testother.cpp b/test/testother.cpp index e176dec88..ef647a80b 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -1280,6 +1280,16 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + // #1533 + checkUninitVar("char a()\n" + "{\n" + " char key;\n" + " struct A msg = { .buf = {&key} };\n" + " init(&msg);\n" + " return key;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + checkUninitVar("void foo()\n" "{\n" " char *buf = malloc(100);\n"