https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89790
Bug ID: 89790 Summary: [9 Regression] ICE segfault in operand_equal_p() at fold-const.c:3000 with -Wduplicated-cond since r269838 Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: belyshev at depni dot sinp.msu.ru CC: rguenth at gcc dot gnu.org Target Milestone: --- Fix for bug 89779 (r269838) caused ICE during gdb build. Reduced testcase, compile with -O -Wduplicated-cond: template <typename> class a { typedef a b; template <typename> void c(); }; template <typename d> template <typename> void a<d>::c() { int f; b g; if (g == 0) ; else if (f) { } } Partial backtrace: Program received signal SIGSEGV, Segmentation fault. operand_equal_p (arg0=0x7ffff76df7e0, arg1=0x7ffff76df740, flags=16) at ../../gcc/gcc/fold-const.c:3000 3000 if (TYPE_UNSIGNED (TREE_TYPE (arg0)) != TYPE_UNSIGNED (TREE_TYPE (arg1)) (gdb) bt #0 operand_equal_p (arg0=0x7ffff76df7e0, arg1=0x7ffff76df740, flags=16) at ../../gcc/gcc/fold-const.c:3000 #1 0x0000000000c9ac8b in operand_equal_p (arg0=arg0@entry=0x7ffff76df7e0, arg1=arg1@entry=0x7ffff76df740, flags=flags@entry=0) at ../../gcc/gcc/fold-const.c:2950 #2 0x0000000000b0c572 in warn_duplicated_cond_add_or_warn (loc=<optimized out>, cond=cond@entry=0x7ffff76df7e0, chain=chain@entry=0x7fffffffdd88) at ../../gcc/gcc/c-family/c-warn.c:2318 #3 0x00000000009c4846 in cp_parser_selection_statement (chain=<optimized out>, if_p=0x0, parser=0x7ffff7fd0ab0) at ../../gcc/gcc/cp/parser.c:11784 #4 cp_parser_statement (parser=0x7ffff7fd0ab0, in_statement_expr=0x0, in_compound=<optimized out>, if_p=0x0, chain=<optimized out>, loc_after_labels=0x7fffffffddec) at ../../gcc/gcc/cp/parser.c:11147 #5 0x00000000009de4f8 in cp_parser_implicitly_scoped_statement (parser=parser@entry=0x7ffff7fd0ab0, if_p=if_p@entry=0x0, guard_tinfo=..., chain=0x25323d0) at ../../gcc/gcc/cp/parser.c:13004 #6 0x00000000009c4788 in cp_parser_selection_statement (chain=<optimized out>, if_p=0x0, parser=0x7ffff7fd0ab0) at ../../gcc/gcc/cp/parser.c:11865 ...