This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug optimization/13066] [tree-ssa] ICE in in invert_truthvalue, at fold-const.c:2554


------- Additional Comments From steven at gcc dot gnu dot org  2004-01-10 00:52 -------
Starting program: /home/steven/devel/ssabuild/gcc/cc1plus -O testcase_ice.cpp 
 nsCOMPtr::operator nsIURI*() const 
 void func() 
 
Breakpoint 1, fancy_abort (file=0x85184e0 "../../tree-ssa/gcc/fold-const.c", 
line=9, 
    function=0x85184e0 "../../tree-ssa/gcc/fold-const.c") at ../../tree-ssa/
gcc/diagnostic.c:584 
584       internal_error ("in %s, at %s:%d", function, trim_filename (file), 
line); 
(gdb) up 
#1  0x0828f518 in invert_truthvalue (arg=0x40237bc8) at ../../tree-ssa/gcc/
fold-const.c:2553 
2553        abort (); 
(gdb) l 
2548 
2549        default: 
2550          break; 
2551        } 
2552      if (TREE_CODE (TREE_TYPE (arg)) != BOOLEAN_TYPE) 
2553        abort (); 
2554      return build1 (TRUTH_NOT_EXPR, type, arg); 
2555    } 
2556 
2557    /* Given a bit-wise operation CODE applied to ARG0 and ARG1, see if 
both 
(gdb) p debug_tree (arg) 
 <var_decl 0x40237bc8 T.2 
    type <integer_type 0x40023658 int SI 
        size <integer_cst 0x40021288 constant invariant 32> 
        unit size <integer_cst 0x40021330 constant invariant 4> 
        align 32 symtab 0 alias set -1 precision 32 min <integer_cst 
0x40021300 -2147483648> max <integer_cst 0x40021318 2147483647> 
        pointer_to_this <pointer_type 0x401612b8>> 
    used ignored SI file testcase_ice.cpp line 17 size <integer_cst 0x40021288 
32> unit size <integer_cst 0x40021330 4> 
    align 32 context <function_decl 0x402377b4 func> chain <var_decl 
0x40237c3c T.3>> 
$4 = void 
(gdb) up 
#2  0x0828f070 in invert_truthvalue (arg=0x400227e0) at ../../tree-ssa/gcc/
fold-const.c:2494 
2494            return build (TRUTH_XOR_EXPR, type, 
(gdb) 
#3  0x08184e98 in cfg_remove_useless_stmts () at ../../tree-ssa/gcc/
tree-cfg.c:1251 
1251        cond = invert_truthvalue (cond); 
(gdb) l 
1246          || !(bb->pred->flags & (EDGE_TRUE_VALUE | EDGE_FALSE_VALUE))) 
1247        return; 
1248 
1249      cond = COND_EXPR_COND (last_stmt (bb->pred->src)); 
1250      if (bb->pred->flags & EDGE_FALSE_VALUE) 
1251        cond = invert_truthvalue (cond); 
1252 
1253      if (TREE_CODE (cond) == VAR_DECL 
1254          || TREE_CODE (cond) == PARM_DECL) 
1255        { 
(gdb) p print_generic_stmt (stderr,last_stmt (bb->pred->src),0) 
if (T.2 ^ SR.9 == 0B) goto <L2>; else goto <L3>; 
$1 = void 
(gdb) p debug_tree (last_stmt (bb->pred->src)->exp.operands[0]) 
 <truth_xor_expr 0x400227e0 
    type <boolean_type 0x40023910 bool unsigned QI 
        size <integer_cst 0x40021138 constant invariant 8> 
        unit size <integer_cst 0x40021150 constant invariant 1> 
        align 8 symtab 0 alias set -1 precision 1 min <integer_cst 0x40021510 
0> max <integer_cst 0x40021558 1>> 
 
    arg 0 <var_decl 0x40237bc8 T.2 
        type <integer_type 0x40023658 int SI 
            size <integer_cst 0x40021288 constant invariant 32> 
            unit size <integer_cst 0x40021330 constant invariant 4> 
            align 32 symtab 0 alias set -1 precision 32 min <integer_cst 
0x40021300 -2147483648> max <integer_cst 0x40021318 2147483647> 
            pointer_to_this <pointer_type 0x401612b8>> 
        used ignored SI file testcase_ice.cpp line 17 size <integer_cst 
0x40021288 32> unit size <integer_cst 0x40021330 4> 
        align 32 context <function_decl 0x402377b4 func> 
        chain <var_decl 0x40237c3c T.3 type <pointer_type 0x40233d24> 
            unsigned used ignored SI file testcase_ice.cpp line 17 
            size <integer_cst 0x40021b58 constant invariant 32> 
            unit size <integer_cst 0x40021bb8 constant invariant 4> 
            align 32 context <function_decl 0x402377b4 func> chain <var_decl 
0x40237cb0 T.4>>> 
    arg 1 <eq_expr 0x40022750 type <integer_type 0x40023658 int> 
 
        arg 0 <var_decl 0x4023fef4 SR.9 type <pointer_type 0x40233d24> 
            unsigned used ignored SI file testcase_ice.cpp line 15 
            size <integer_cst 0x40232c00 constant invariant 32> 
            unit size <integer_cst 0x40232c18 constant invariant 4> 
            align 32 context <function_decl 0x402377b4 func>> 
        arg 1 <integer_cst 0x40232978 constant invariant 0>>> 
$3 = void 
 
This seems to fail already when genericizing (testcase_ice.cpp.t04.generic): 
 
;; Function void func() (_Z4funcv) 
 
void func() () 
{ 
  struct nsIURI * T.1; 
  int T.2; 
  struct nsIURI * T.3; 
  int T.4; 
  bool T.5; 
 
  { 
    struct nsCOMPtr u1; 
 
    { 
      T.1 = operator 1 (&u1); 
      T.2 = T.1 != 0B; 
      T.3 = operator 1 (&u1); 
      T.4 = T.3 == 0B; 
      T.5 = T.2 ^ T.4; 
      if (T.5) 
        { 
          { 
            return; 
          } 
        } 
      else 
        { 
 
        } 
    } 
  } 
} 
 
Note how T.2 is declared as an int, but used in a boolean expr.  I would say 
it should have been declared as a bool from the start... 
 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13066


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]