File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,8 @@ static bool isAutoVar(const Token *tok)
9999 } while (Token::Match (tok, " %name% .|::" ));
100100 if (Token::Match (tok, " %name% (" ))
101101 return false ;
102+ if (tok->variable () && tok->variable ()->isPointer ())
103+ return false ;
102104 }
103105 return true ;
104106}
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ class TestAutoVariables : public TestFixture {
6868 TEST_CASE (testautovar14); // ticket #4776 - assignment of function parameter, goto
6969 TEST_CASE (testautovar15); // ticket #6538
7070 TEST_CASE (testautovar16); // ticket #8114
71+ TEST_CASE (testautovar17);
7172 TEST_CASE (testautovar_array1);
7273 TEST_CASE (testautovar_array2);
7374 TEST_CASE (testautovar_array3);
@@ -504,6 +505,17 @@ class TestAutoVariables : public TestFixture {
504505 ASSERT_EQUALS (" " , errout_str ());
505506 }
506507
508+ void testautovar17 () {
509+ check (" struct S { int* p; };\n " // #14257
510+ " int a[10];\n "
511+ " void f(int** q) {\n "
512+ " S s;\n "
513+ " s.p = a;\n "
514+ " *q = &s.p[0];\n "
515+ " }\n " );
516+ ASSERT_EQUALS (" " , errout_str ());
517+ }
518+
507519 void testautovar_array1 () {
508520 check (" void func1(int* arr[2])\n "
509521 " {\n "
You can’t perform that action at this time.
0 commit comments