public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dcb314 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rust/108126] New: rust meets cppcheck Date: Thu, 15 Dec 2022 11:31:02 +0000 [thread overview] Message-ID: <bug-108126-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108126 Bug ID: 108126 Summary: rust meets cppcheck Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rust Assignee: unassigned at gcc dot gnu.org Reporter: dcb314 at hotmail dot com CC: dkm at gcc dot gnu.org, gcc-rust at gcc dot gnu.org Target Milestone: --- I just ran the C/C++ static analyser over the new source code of rust. First the errors: trunk.d1/gcc/rust/ast/rust-cond-compilation.h:228:65: error: Member variable 'cfg_attrs' is initialized by itself. [selfInitialization] trunk.d1/gcc/rust/typecheck/rust-tyty.h:1635:46: error: Reference to local variable returned. [returnReference] trunk.d1/gcc/rust/typecheck/rust-tyty.h:1636:58: error: Reference to local variable returned. [returnReference] trunk.d1/gcc/rust/typecheck/rust-tyty.h:558:58: error: Reference to local variable returned. [returnReference] trunk.d1/gcc/rust/util/rust-optional.h:157:12: error: Reference to local variable returned. [returnReference] Next, the warnings: trunk.d1/gcc/rust/parse/rust-parse-impl.h:12423:21: warning: Access of moved variable 'outer_attrs'. [accessMoved] trunk.d1/gcc/rust/typecheck/rust-tyty-rules.h:394:7: warning: Class 'BaseRules' does not have a copy constructor which is recommended since it has dynamic memory/resource allocation(s). [noCopyConstructor] trunk.d1/gcc/rust/typecheck/rust-tyty-rules.h:394:7: warning: Class 'BaseRules' does not have a operator= which is recommended since it has dynamic memory/resource allocation(s). [noOperatorEq] trunk.d1/gcc/rust/typecheck/rust-substitution-mapper.h:146:7: warning: Class 'SubstMapper' does not have a copy constructor which is recommended since it has dynamic memory/resource allocation(s). [noCopyConstructor] trunk.d1/gcc/rust/typecheck/rust-substitution-mapper.h:146:7: warning: Class 'SubstMapper' does not have a operator= which is recommended since it has dynamic memory/resource allocation(s). [noOperatorEq] trunk.d1/gcc/rust/typecheck/rust-substitution-mapper.h:261:7: warning: Class 'SubstMapperInternal' does not have a copy constructor which is recommended since it has dynamic memory/resource allocation(s). [noCopyConstructor] trunk.d1/gcc/rust/typecheck/rust-substitution-mapper.h:261:7: warning: Class 'SubstMapperInternal' does not have a operator= which is recommended since it has dynamic memory/resource allocation(s). [noOperatorEq] trunk.d1/gcc/rust/typecheck/rust-tyty-call.h:75:7: warning: Class 'TypeCheckCallExpr' does not have a copy constructor which is recommended since it has dynamic memory/resource allocation(s). [noCopyConstructor] trunk.d1/gcc/rust/typecheck/rust-tyty-call.h:75:7: warning: Class 'TypeCheckCallExpr' does not have a operator= which is recommended since it has dynamic memory/resource allocation(s). [noOperatorEq] trunk.d1/gcc/rust/typecheck/rust-hir-type-check-struct.cc:29:5: warning: Class 'TypeCheckStructExpr' does not have a copy constructor which is recommended since it has dynamic memory/resource allocation(s). [noCopyConstructor] trunk.d1/gcc/rust/typecheck/rust-hir-type-check-struct.cc:29:5: warning: Class 'TypeCheckStructExpr' does not have a operator= which is recommended since it has dynamic memory/resource allocation(s). [noOperatorEq] trunk.d1/gcc/rust/typecheck/rust-tyty.h:664:9: warning: Either the condition 'argument!=nullptr' is redundant or there is possible null pointer dereference: argument. [nullPointerRedundantCheck] trunk.d1/gcc/rust/typecheck/rust-tyty.h:740:29: warning: Either the condition 'index>mappings.size()' is redundant or 'index' can have the value mappings.size(). Expression 'mappings.at(index)' cause access out of bounds. [containerOutOfBounds] trunk.d1/gcc/rust/expand/rust-macro-substitute-ctx.cc:77:25: warning: Either the condition 'it==fragments.end()' is redundant or there is possible dereference of an invalid iterator: it. [derefInvalidIteratorRedundantCheck] trunk.d1/gcc/rust/backend/rust-tree.cc:155:5: warning: Label 'CASE_CONVERT' is not used. Should this be a 'case' of the enclosing switch()? [unusedLabelSwitch] trunk.d1/gcc/rust/backend/rust-tree.cc:45:5: warning: Label 'CASE_CONVERT' is not used. Should this be a 'case' of the enclosing switch()? [unusedLabelSwitch] trunk.d1/gcc/rust/ast/rust-expr.h:1853:3: warning: Member variable 'CallExpr::fndeclRef' is not initialized in the constructor. [uninitMemberVar] trunk.d1/gcc/rust/ast/rust-expr.h:1862:3: warning: Member variable 'CallExpr::fndeclRef' is not initialized in the copy constructor. [uninitMemberVar] trunk.d1/gcc/rust/util/rust-canonical-path.h:51:18: warning: Member variable 'CanonicalPath::crate_num' is not assigned a value in 'CanonicalPath::operator='. [operatorEqVarError] trunk.d1/gcc/rust/util/rust-canonical-path.h:49:3: warning: Member variable 'CanonicalPath::crate_num' is not initialized in the copy constructor. [uninitMemberVar] trunk.d1/gcc/rust/ast/rust-stmt.h:112:12: warning: Member variable 'LetStmt::inferedType' is not assigned a value in 'LetStmt::operator='. [operatorEqVarError] trunk.d1/gcc/rust/ast/rust-stmt.h:88:3: warning: Member variable 'LetStmt::inferedType' is not initialized in the constructor. [uninitMemberVar] trunk.d1/gcc/rust/ast/rust-stmt.h:97:3: warning: Member variable 'LetStmt::inferedType' is not initialized in the copy constructor. [uninitMemberVar] trunk.d1/gcc/rust/lex/rust-lex.cc:119:8: warning: Member variable 'Lexer::current_char' is not initialized in the constructor. [uninitMemberVar] trunk.d1/gcc/rust/lex/rust-lex.cc:125:8: warning: Member variable 'Lexer::current_char' is not initialized in the constructor. [uninitMemberVar] trunk.d1/gcc/rust/rust-session-manager.h:286:3: warning: Member variable 'Session::backend' is not initialized in the constructor. [uninitMemberVar] trunk.d1/gcc/rust/rust-session-manager.h:286:3: warning: Member variable 'Session::linemap' is not initialized in the constructor. [uninitMemberVar] trunk.d1/gcc/rust/rust-session-manager.h:286:3: warning: Member variable 'Session::mappings' is not initialized in the constructor. [uninitMemberVar] trunk.d1/gcc/rust/typecheck/rust-hir-type-check-struct.cc:27:22: warning: Member variable 'TypeCheckStructExpr::resolved_field_value_expr' is not initialized in the constructor. [uninitMemberVarPrivate] trunk.d1/gcc/rust/util/rust-hir-map.cc:411:4: warning: Possible null pointer dereference: parent_block [nullPointer] trunk.d1/gcc/rust/ast/rust-ast.h:1211:10: warning: The class 'Lifetime' defines member variable with name 'node_id' also defined in its parent class 'TypeParamBound'. [duplInheritedMember] trunk.d1/gcc/rust/ast/rust-macro.h:565:10: warning: The class 'MacroInvocation' defines member variable with name 'node_id' also defined in its parent class 'Expr'. [duplInheritedMember] trunk.d1/gcc/rust/ast/rust-macro.h:565:10: warning: The class 'MacroInvocation' defines member variable with name 'node_id' also defined in its parent class 'ExternalItem'. [duplInheritedMember] trunk.d1/gcc/rust/ast/rust-macro.h:565:10: warning: The class 'MacroInvocation' defines member variable with name 'node_id' also defined in its parent class 'Stmt'. [duplInheritedMember] trunk.d1/gcc/rust/ast/rust-macro.h:565:10: warning: The class 'MacroInvocation' defines member variable with name 'node_id' also defined in its parent class 'TraitItem'. [duplInheritedMember] trunk.d1/gcc/rust/ast/rust-macro.h:565:10: warning: The class 'MacroInvocation' defines member variable with name 'node_id' also defined in its parent class 'Type'. [duplInheritedMember] trunk.d1/gcc/rust/checks/lints/rust-lint-marklive.h:292:23: warning: The class 'MarkLive' defines member variable with name 'mappings' also defined in its parent class 'MarkLiveBase'. [duplInheritedMember] trunk.d1/gcc/rust/checks/lints/rust-lint-scan-deadcode.h:137:23: warning: The class 'ScanDeadcode' defines member variable with name 'mappings' also defined in its parent class 'MarkLiveBase'. [duplInheritedMember] There were over 350 style warnings, most for lack of use of STL, but I noticed these two: trunk.d1/gcc/rust/resolve/rust-ast-resolve-type.cc:536:15: style: Redundant condition: !is_type. 'is_type || (!is_type && !is_value)' is equivalent to 'is_type || !is_value' [redundantCondition] trunk.d1/gcc/rust/typecheck/rust-hir-type-check-expr.cc:1113:7: style: Redundant condition: loop_context_type->get_kind()==TyTy::TypeKind::INFER. 'A || (!A && B)' is equivalent to 'A || B' [redundantCondition] There were about 140 performance warnings, mostly about preferring parameter passing by const reference. Full lists for all these various possible problems are available on request.
next reply other threads:[~2022-12-15 11:31 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-12-15 11:31 dcb314 at hotmail dot com [this message] 2022-12-15 11:51 ` [Bug rust/108126] " redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-108126-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).