Skip to content

ICE - when if contains &str instead of bool #2495

@MahadMuhammad

Description

@MahadMuhammad

ICE - when if contains &str instead of bool


Code Tested from E0308

#![allow(unused)]
fn main() {

if "Not a bool" {
// ^^^^^^^^^^^^ expected `bool`, found `&str`
}


}

Meta

  • What version of Rust GCC were you using, git sha c55ca4e
  • gccrs (Compiler-Explorer-Build-gcc-7bb4d1b7502ce905f4fef89c7dba8b37cd12acdf-binutils-2.40) 13.0.1 20230417 (experimental)

Error output

  • Internal Compiler Error.

Backtrace

Analyzing compilation unit
../mahad-testsuite/E0308.rs: In function ‘E0308::main’:
../mahad-testsuite/E0308.rs:4:1: internal compiler error: in fold_convert_loc, at fold-const.cc:2504
  4 | if "Not a bool" {
    | ^~
0x8010bf fold_convert_loc(unsigned int, tree_node*, tree_node*)
  ../../gccrs/gcc/fold-const.cc:2504
0xf63ac8 gimplify_cond_expr
  ../../gccrs/gcc/gimplify.cc:4441
0xf55244 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
  ../../gccrs/gcc/gimplify.cc:16333
0xf580da gimplify_stmt(tree_node**, gimple**)
  ../../gccrs/gcc/gimplify.cc:7219
0xf559cb gimplify_statement_list
  ../../gccrs/gcc/gimplify.cc:2019
0xf559cb gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
  ../../gccrs/gcc/gimplify.cc:16821
0xf580da gimplify_stmt(tree_node**, gimple**)
  ../../gccrs/gcc/gimplify.cc:7219
0xf58767 gimplify_bind_expr
  ../../gccrs/gcc/gimplify.cc:1430
0xf5508b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
  ../../gccrs/gcc/gimplify.cc:16577
0xf76943 gimplify_stmt(tree_node**, gimple**)
  ../../gccrs/gcc/gimplify.cc:7219
0xf76943 gimplify_body(tree_node*, bool)
  ../../gccrs/gcc/gimplify.cc:17638
0xf76d9f gimplify_function_tree(tree_node*)
  ../../gccrs/gcc/gimplify.cc:17837
0xd95c37 cgraph_node::analyze()
  ../../gccrs/gcc/cgraphunit.cc:684
0xd98237 analyze_functions
  ../../gccrs/gcc/cgraphunit.cc:1247
0xd98f81 symbol_table::finalize_compilation_unit()
  ../../gccrs/gcc/cgraphunit.cc:2554
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions