[Bug optimization/14692] [3.5 Regression] ICE in canon_condition

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Mar 23 14:34:00 GMT 2004


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-23 14:34 -------
Confirmed.
Here is the RTL which it is ICE on:
(ne:SI (const_int 1 [0x1])
    (const_int 1 [0x1]))
Backtrace:
#0  fancy_abort (file=0x7598bc "/Users/pinskia/src/gcc-tree-ssa/gcc/gcc/loop-iv.c", line=1413, 
function=0x7599b8 "canon_condition") at /Users/pinskia/src/gcc-tree-ssa/gcc/gcc/diagnostic.c:583
#1  0x006a742c in canon_condition (cond=0x414dd2a0) at /Users/pinskia/src/gcc-tree-ssa/gcc/gcc/
loop-iv.c:1413
#2  0x0062b918 in may_unswitch_on (bb=0x414d9364, loop=0x41304210, cinsn=0xbffff580) at /
Users/pinskia/src/gcc-tree-ssa/gcc/gcc/loop-unswitch.c:236
#3  0x0062bc18 in unswitch_single_loop (loops=0x413029a0, loop=0x41304210, 
cond_checked=0x0, num=0) at /Users/pinskia/src/gcc-tree-ssa/gcc/gcc/loop-unswitch.c:325
#4  0x0062b51c in unswitch_loops (loops=0x413029a0) at /Users/pinskia/src/gcc-tree-ssa/gcc/gcc/
loop-unswitch.c:160
#5  0x003713d8 in rest_of_handle_loop2 (decl=0x414d22e8, insns=0x414549e0) at /Users/pinskia/
src/gcc-tree-ssa/gcc/gcc/passes.c:1312
#6  0x00371e38 in rest_of_compilation (decl=0x414d22e8) at /Users/pinskia/src/gcc-tree-ssa/gcc/
gcc/passes.c:1601
#7  0x00374418 in tree_rest_of_compilation (fndecl=0x414d22e8, nested_p=false) at /Users/pinskia/
src/gcc-tree-ssa/gcc/gcc/tree-optimize.c:596
#8  0x0002fab0 in c_expand_body_1 (fndecl=0x414d22e8, nested_p=0) at /Users/pinskia/src/gcc-
tree-ssa/gcc/gcc/c-decl.c:6195
#9  0x0002fe4c in c_expand_body (fndecl=0x414d22e8) at /Users/pinskia/src/gcc-tree-ssa/gcc/gcc/
c-decl.c:6227
#10 0x00365a10 in cgraph_expand_function (node=0x414d2aa8) at /Users/pinskia/src/gcc-tree-ssa/
gcc/gcc/cgraphunit.c:789
#11 0x003688dc in cgraph_expand_all_functions () at /Users/pinskia/src/gcc-tree-ssa/gcc/gcc/
cgraphunit.c:1671
#12 0x00368d34 in cgraph_optimize () at /Users/pinskia/src/gcc-tree-ssa/gcc/gcc/cgraphunit.c:1761
#13 0x000a4908 in c_objc_common_finish_file () at /Users/pinskia/src/gcc-tree-ssa/gcc/gcc/c-objc-
common.c:243
#14 0x0000f054 in finish_file () at /Users/pinskia/src/gcc-tree-ssa/gcc/gcc/c-lang.c:199
#15 0x000960cc in c_common_parse_file (set_yydebug=0) at /Users/pinskia/src/gcc-tree-ssa/gcc/
gcc/c-opts.c:1244
#16 0x0011c700 in compile_file () at /Users/pinskia/src/gcc-tree-ssa/gcc/gcc/toplev.c:1627
#17 0x0011f0e8 in do_compile () at /Users/pinskia/src/gcc-tree-ssa/gcc/gcc/toplev.c:2623
#18 0x0011f180 in toplev_main (argc=4, argv=0xbffffc78) at /Users/pinskia/src/gcc-tree-ssa/gcc/
gcc/toplev.c:2655
#19 0x000c4c24 in main (argc=4, argv=0xbffffc78) at /Users/pinskia/src/gcc-tree-ssa/gcc/gcc/
main.c:35

And miss optimization on the tree-level:
  dc_ptr1 = (const unsigned char *)pos;
  pos = pos - 1B;
  if ((int)dc_ptr1 - (int)pos == 1) goto <L1>; else goto <L2>;
since pos - 1 == dc_ptr1 then "(int)dc_ptr1 - (int)pos == 1" will always be true.


And here is a testcase which fails on the mainline (derived from the last tree dump):
void assert_failed (void);
void eidecpos_1 (unsigned char *pos, long n)
{
  const unsigned char * dc_ptr1;
  int i;
if (n > 0) goto L11;else goto L4;
L11:
  i = 0;
L0:
 dc_ptr1 = (const unsigned char *)pos;
  pos = pos - 1;
if ((int)dc_ptr1 - (int)pos == 1) goto L1;else goto L2;
L1:
 assert_failed();

L2:
  i = i +1;
  if (i < n) goto L0;else goto L4;

L4:
   return;
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |RTL
      Known to fail|                            |3.5.0
      Known to work|                            |3.3.3
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-23 14:34:15
               date|                            |
            Summary|[tree-ssa] ICE in           |[3.5 Regression] ICE in
                   |canon_condition             |canon_condition
   Target Milestone|---                         |3.5.0
            Version|tree-ssa                    |3.5.0


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



More information about the Gcc-bugs mailing list