From 5f31242ee80856b019c3600eb0a6e573629bc0f0 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sun, 22 Feb 2015 12:03:53 +0100 Subject: [PATCH] CheckOther::checkRedundantAssignment(): Bail out on inline assembly (#6525) --- lib/checkother.cpp | 2 +- test/testother.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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() {