http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59632
Bug ID: 59632 Summary: ICE with erroneous loop condition after #pragma GCC ivdep Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org The following invalid code snippet triggers an ICE on trunk: ============================================================== void foo() { #pragma GCC ivdep while(foo()) {} } ============================================================== bug.cc: In function 'void foo()': bug.cc:4:13: error: could not convert 'foo()' from 'void' to 'bool' while(foo()) {} ^ bug.cc:1:6: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in fold_comparison, at fold-const.c:9316 void foo() ^ 0xd8f855 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc/gcc/tree.c:9243 0x93ef66 tree_class_check ../../gcc/gcc/tree.h:2830 0x93ef66 fold_comparison ../../gcc/gcc/fold-const.c:9316 0x941e1b fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*) ../../gcc/gcc/fold-const.c:12953 0x96309a fold_build2_stat_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*) ../../gcc/gcc/fold-const.c:15194 0x93f64d fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*) ../../gcc/gcc/fold-const.c:10181 0xba0e8c fold_cond_expr_cond() ../../gcc/gcc/tree-cfg.c:650 0xba996e make_edges ../../gcc/gcc/tree-cfg.c:780 0xba996e build_gimple_cfg ../../gcc/gcc/tree-cfg.c:260 0xba996e execute_build_cfg ../../gcc/gcc/tree-cfg.c:336 0xba996e execute ../../gcc/gcc/tree-cfg.c:374 Please submit a full bug report, [etc.] Tobias, this appeared right after your patch 2013-10-30 Tobias Burnus <bur...@net-b.de> PR other/33426 * cp-tree.h (RANGE_FOR_IVDEP): Define. (cp_convert_range_for, finish_while_stmt_cond, finish_do_stmt, finish_for_cond): Take 'bool ivdep' parameter. * cp-array-notation.c (create_an_loop): Update call. * init.c (build_vec_init): Ditto. * pt.c (tsubst_expr): Ditto. * parser.c (cp_parser_iteration_statement, cp_parser_for, cp_parser_range_for, cp_convert_range_for): Update calls. (cp_parser_pragma): Accept GCC ivdep for 'while' and 'do'. * semantics.c (finish_while_stmt_cond, finish_do_stmt, finish_for_cond): Optionally build ivdep annotation. Would you mind having a look?