File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ bool CheckAutoVariables::isAutoVarArray(const Token *tok)
117117 return true ;
118118
119119 // ValueFlow
120- if (var->isPointer ()) {
120+ if (var->isPointer () && !var-> isArgument () ) {
121121 for (std::list<ValueFlow::Value>::const_iterator it = tok->values .begin (); it != tok->values .end (); ++it) {
122122 const ValueFlow::Value &val = *it;
123123 if (val.tokvalue && isAutoVarArray (val.tokvalue ))
Original file line number Diff line number Diff line change @@ -636,6 +636,16 @@ class TestAutoVariables : public TestFixture {
636636 " return str;\n "
637637 " }" );
638638 ASSERT_EQUALS (" [test.cpp:7]: (error) Pointer to local array variable returned.\n " , errout.str ());
639+
640+ check (" char * format_reg(char *outbuffer_start) {\n "
641+ " return outbuffer_start;\n "
642+ " }\n "
643+ " void print_with_operands() {\n "
644+ " char temp[42];\n "
645+ " char *tp = temp;\n "
646+ " tp = format_reg(tp);\n "
647+ " }" );
648+ ASSERT_EQUALS (" " , errout.str ());
639649 }
640650
641651 void returnLocalVariable2 () {
You can’t perform that action at this time.
0 commit comments