File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1420,6 +1420,8 @@ const Token *Token::getValueTokenDeadPointer() const
14201420 const Variable * const var = vartok->variable ();
14211421 if (var->isStatic () || var->isReference ())
14221422 continue ;
1423+ if (var->scope ()->type == Scope::eUnion && var->scope ()->nestedIn == this ->scope ())
1424+ continue ;
14231425 // variable must be in same function (not in subfunction)
14241426 if (functionscope != getfunctionscope (var->scope ()))
14251427 continue ;
Original file line number Diff line number Diff line change @@ -3912,6 +3912,17 @@ class TestUninitVar : public TestFixture {
39123912 " dosth();\n "
39133913 " }" );
39143914 ASSERT_EQUALS (" [test.cpp:7]: (error) Dead pointer usage. Pointer 'former_hover' is dead if it has been assigned '&item' at line 5.\n " , errout.str ());
3915+
3916+ // #6575
3917+ checkDeadPointer (" void trp_deliver_signal() {\n "
3918+ " union {\n "
3919+ " Uint32 theData[25];\n "
3920+ " EventReport repData;\n "
3921+ " };\n "
3922+ " EventReport * rep = &repData;\n "
3923+ " rep->setEventType(NDB_LE_Connected);\n "
3924+ " }" );
3925+ ASSERT_EQUALS (" " , errout.str ());
39153926 }
39163927};
39173928
You can’t perform that action at this time.
0 commit comments