aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2021-04-02 21:24:34 +0200
committerPhilip Herron <herron.philip@googlemail.com>2021-04-05 10:38:57 +0100
commit868ce1ffdd7242934375753a7fa7c339e391338b (patch)
tree746f37a727236fcd88b3e346957af348426212b5
parentc896b2553969b169120aad029cb793d1cca1062d (diff)
downloadgcc-868ce1ffdd7242934375753a7fa7c339e391338b.zip
gcc-868ce1ffdd7242934375753a7fa7c339e391338b.tar.gz
gcc-868ce1ffdd7242934375753a7fa7c339e391338b.tar.bz2
Address 'error: ‘op’ may be used uninitialized in this function [-Werror=maybe-uninitialized]' diagnostic [#336]
In file included from [...]/gcc/rust/hir/tree/rust-hir-full.h:24, from [...]/gcc/rust/hir/rust-ast-lower.h:25, from [...]/gcc/rust/hir/rust-ast-lower.cc:19: [...]/gcc/rust/hir/tree/rust-hir-expr.h: In member function ‘virtual void Rust::HIR::ASTLoweringExpr::visit(Rust::AST::CompoundAssignmentExpr&)’: [...]/gcc/rust/hir/tree/rust-hir-expr.h:426:7: error: ‘op’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 426 | expr_type (expr_kind), right_expr (std::move (right_value)) | ^~~~~~~~~~~~~~~~~~~~~ In file included from [...]/gcc/rust/hir/rust-ast-lower-type.h:24, from [...]/gcc/rust/hir/rust-ast-lower-item.h:25, from [...]/gcc/rust/hir/rust-ast-lower.cc:20: [...]/gcc/rust/hir/rust-ast-lower-expr.h:471:33: note: ‘op’ was declared here 471 | ArithmeticOrLogicalOperator op; | ^~
-rw-r--r--gcc/rust/hir/rust-ast-lower-expr.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-expr.h b/gcc/rust/hir/rust-ast-lower-expr.h
index 1922a3b..c59412f 100644
--- a/gcc/rust/hir/rust-ast-lower-expr.h
+++ b/gcc/rust/hir/rust-ast-lower-expr.h
@@ -501,6 +501,8 @@ public:
case CompoundAssignmentOperator::RIGHT_SHIFT:
op = ArithmeticOrLogicalOperator::RIGHT_SHIFT;
break;
+ default:
+ gcc_unreachable ();
}
HIR::Expr *asignee_expr