diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 8c1a4560b..69782741f 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -614,7 +614,7 @@ void CheckOther::checkRedundantAssignment() memAssignments.clear(); } else if (Token::Match(tok, "for|if|while (")) { tok = tok->linkAt(1); - } else if (Token::Match(tok, "break|return|continue|throw|goto")) { + } else if (Token::Match(tok, "break|return|continue|throw|goto|asm")) { varAssignments.clear(); memAssignments.clear(); } else if (tok->type() == Token::eVariable && !Token::Match(tok, "%name% (")) { diff --git a/test/testother.cpp b/test/testother.cpp index fef5266a0..109d77a32 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -5450,6 +5450,14 @@ private: " s->foo[s->x++] = 2;\n" " s->d[1].fc.i++;\n" "}"); + + // #6525 - inline assembly + check("void f(int i) {\n" + " i = 1;\n" + " asm(\"foo\");\n" + " i = 1;\n" + "}"); + ASSERT_EQUALS("", errout.str()); } void redundantMemWrite() {