@@ -831,6 +831,8 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
831
831
this ->visit_expr (*exprs[i]);
832
832
ASR::expr_t * expr = nullptr ;
833
833
ASR::call_arg_t arg;
834
+ arg.loc .first = -1 ;
835
+ arg.loc .last = -1 ;
834
836
if (tmp) {
835
837
expr = ASRUtils::EXPR (tmp);
836
838
arg.loc = expr->base .loc ;
@@ -1009,7 +1011,7 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
1009
1011
1010
1012
ASR::ttype_t * get_type_from_var_annotation (std::string var_annotation,
1011
1013
const Location& loc, Vec<ASR::dimension_t >& dims,
1012
- AST::expr_t ** m_args=nullptr , size_t n_args=0 ,
1014
+ AST::expr_t ** m_args=nullptr , [[maybe_unused]] size_t n_args=0 ,
1013
1015
bool raise_error=true , ASR::abiType abi=ASR::abiType::Source,
1014
1016
bool is_argument=false ) {
1015
1017
ASR::ttype_t * type = nullptr ;
@@ -2364,7 +2366,7 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
2364
2366
result = left_value >> right_value;
2365
2367
break ;
2366
2368
}
2367
- default : { LCOMPILERS_ASSERT ( false ); } // should never happen
2369
+ default : { throw SemanticError ( " ICE: Unknown binary operator " , loc ); } // should never happen
2368
2370
}
2369
2371
value = ASR::down_cast<ASR::expr_t >(ASR::make_IntegerConstant_t (
2370
2372
al, loc, result, dest_type));
@@ -2418,7 +2420,7 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
2418
2420
result = left_value >> right_value;
2419
2421
break ;
2420
2422
}
2421
- default : { LCOMPILERS_ASSERT ( false ); } // should never happen
2423
+ default : { throw SemanticError ( " ICE: Unknown binary operator " , loc ); } // should never happen
2422
2424
}
2423
2425
value = ASR::down_cast<ASR::expr_t >(ASR::make_UnsignedIntegerConstant_t (
2424
2426
al, loc, result, dest_type));
@@ -2460,7 +2462,7 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
2460
2462
case (ASR::binopType::Mul): { result = left_value * right_value; break ; }
2461
2463
case (ASR::binopType::Div): { result = left_value / right_value; break ; }
2462
2464
case (ASR::binopType::Pow): { result = std::pow (left_value, right_value); break ; }
2463
- default : { LCOMPILERS_ASSERT ( false ); }
2465
+ default : { throw SemanticError ( " ICE: Unknown binary operator " , loc ); }
2464
2466
}
2465
2467
value = ASR::down_cast<ASR::expr_t >(ASR::make_RealConstant_t (
2466
2468
al, loc, result, dest_type));
@@ -3293,7 +3295,7 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
3293
3295
void visit_NamedExpr (const AST::NamedExpr_t &x) {
3294
3296
this ->visit_expr (*x.m_target );
3295
3297
ASR::expr_t *target = ASRUtils::EXPR (tmp);
3296
- ASR::ttype_t *target_type = ASRUtils::expr_type (target);
3298
+ [[maybe_unused]] ASR::ttype_t *target_type = ASRUtils::expr_type (target);
3297
3299
this ->visit_expr (*x.m_value );
3298
3300
ASR::expr_t *value = ASRUtils::EXPR (tmp);
3299
3301
ASR::ttype_t *value_type = ASRUtils::expr_type (value);
@@ -3400,7 +3402,7 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
3400
3402
ASR::expr_t *left = ASRUtils::EXPR (tmp);
3401
3403
this ->visit_expr (*x.m_right );
3402
3404
ASR::expr_t *right = ASRUtils::EXPR (tmp);
3403
- ASR::binopType op;
3405
+ ASR::binopType op = ASR::binopType::Add /* temporary assignment */ ;
3404
3406
std::string op_name = " " ;
3405
3407
switch (x.m_op ) {
3406
3408
case (AST::operatorType::Add) : { op = ASR::binopType::Add; break ; }
@@ -5611,7 +5613,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
5611
5613
ASR::expr_t *right = ASRUtils::EXPR (tmp);
5612
5614
ASR::ttype_t * left_type = ASRUtils::expr_type (left);
5613
5615
ASR::ttype_t * right_type = ASRUtils::expr_type (right);
5614
- ASR::binopType op;
5616
+ ASR::binopType op = ASR::binopType::Add /* temporary assignment */ ;
5615
5617
std::string op_name = " " ;
5616
5618
switch (x.m_op ) {
5617
5619
case (AST::operatorType::Add) : { op = ASR::binopType::Add; break ; }
@@ -6322,7 +6324,9 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
6322
6324
result = (strcmp < 0 || strcmp == 0 );
6323
6325
break ;
6324
6326
}
6325
- default : LCOMPILERS_ASSERT (false ); // should never happen
6327
+ default : {
6328
+ throw SemanticError (" ICE: Unknown compare operator" , x.base .base .loc ); // should never happen
6329
+ }
6326
6330
}
6327
6331
value = ASR::down_cast<ASR::expr_t >(ASR::make_LogicalConstant_t (
6328
6332
al, x.base .base .loc , result, type));
0 commit comments