[ i486 ] gcc -O2 -fno-strict-aliasing -fwrapv -march=i486 -ggdb -DHAVE_POSIX_REGCOMP -c -o fetch.o fetch.c cc1: out of memory allocating 4064 bytes after a total of 1292098548 bytes [ powerpc ] gcc -O2 -fno-strict-aliasing -fwrapv -fsigned-char -ggdb -DHAVE_POSIX_REGCOMP -c -o fetch.o fetch.c cc: Internal error: Killed (program cc1) flags to reporduce bug: '-O2 -fwrapv -march=i486' note that e.g. with -march=i686 it works fine. (gdb) bt #0 0x00000000006bd510 in ggc_alloc_stat () #1 0x00000000006a3e14 in make_node_stat () #2 0x00000000006a6c76 in build2_stat () #3 0x0000000000562056 in fold_build2_stat () #4 0x000000000055c83c in fold_binary () #5 0x0000000000562040 in fold_build2_stat () #6 0x00000000006c5adf in extract_range_from_assert () #7 0x00000000006c6dcb in extract_range_from_expr () #8 0x00000000006c9e9e in vrp_visit_assignment () #9 0x00000000006cabfd in vrp_visit_stmt () #10 0x00000000004a08f8 in simulate_stmt () #11 0x00000000004a0bfa in process_ssa_edge_worklist () #12 0x00000000004a1916 in ssa_propagate () #13 0x00000000006cc3a4 in execute_vrp () #14 0x00000000006c0199 in execute_one_pass () #15 0x00000000006c022c in execute_pass_list () #16 0x00000000006c0240 in execute_pass_list () #17 0x000000000045d12e in tree_rest_of_compilation () #18 0x000000000040cac3 in c_expand_body () #19 0x00000000006fa50f in cgraph_expand_function () #20 0x00000000006fa646 in cgraph_expand_all_functions () #21 0x00000000006faa6b in cgraph_optimize () #22 0x000000000040debf in c_write_global_declarations () #23 0x00000000006a2419 in compile_file () #24 0x00000000006a38ed in do_compile () #25 0x00000000006a394e in toplev_main () #26 0x000000000044a601 in main ()
Created attachment 11768 [details] i486 precompiled testcase.
I can reproduce this on the mainline with a cross to powerpc64-linux-gnu with "-m32 -O2 -fwrapv".
I can reproduce it on the 4.1 branch on i686, but not on trunk. Very slowly eating all of memory. Reducing.
Reduced testcase, -O -ftree-vrp -fwrapv extern int foo(const char *); extern int verbose; struct newsgroup { char* name; }; extern struct newsgroup** stufftoget; extern char *l; void checkgroups(int last) { int window = 0; int outstanding = 0; while (window < last || outstanding) { while (outstanding < 47 && window < last) { if (window < last) { outstanding++; if (verbose > 1) foo(stufftoget[window]->name); foo(stufftoget[window++]->name); } } if (outstanding > 0) { if (foo(l) < 5 ); } } }
Visiting statement: window_6 = ASSERT_EXPR <window_1, window_1 < last_7>; .... ) (res = scev_not_known)) Found new range for window_6: [-INF, last_7 + -1] Simulating statement (from ssa_edges): last_50 = ASSERT_EXPR <last_7, window_6 < last_7>; Visiting statement: last_50 = ASSERT_EXPR <last_7, window_6 < last_7>; .... (res = last_7)) Found new range for last_50: [window_6 + 1, +INF] and over and over and over.
Slightly more reduced (for 4.1.2 on i686, trunk doesn't fail here): extern void bar(int); void checkgroups(int last, int verbose) { int window = 0; int outstanding = 0; while (window < last || outstanding) { while (outstanding < 47 && window < last) { if (window < last) { outstanding++; if (verbose) bar(window); bar(window++); } } if (outstanding > 0) bar(0); } }
VRP relies on pointer equivalence in update_value_range, but we get (gdb) call debug_generic_expr (var) windowD.1282_5 (gdb) print *old_vr $11 = {type = VR_RANGE, min = 0xb7ce93c0, max = 0xb7cf0678, equiv = 0x88c69a0} (gdb) print *new_vr $12 = {type = VR_RANGE, min = 0xb7ce93c0, max = 0xb7cf072c, equiv = 0x88c6cec} (gdb) call debug_generic_expr (old_vr->max) lastD.1278_7 + -1 (gdb) call debug_generic_expr (new_vr->max) lastD.1278_7 + -1 so, the fix is to use operand_equal_p here.
Subject: Bug number PR28187 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00195.html
Subject: Bug 28187 Author: rguenth Date: Fri Jul 7 12:31:29 2006 New Revision: 115255 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115255 Log: 2006-07-07 Richard Guenther <rguenther@suse.de> PR tree-optimization/28187 * tree-vrp.c (vrp_operand_equal_p): New function. (vrp_bitmap_equal_p): Likewise. (update_value_range): Use them to compare old and new max and min values. * gcc.dg/pr28187.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/pr28187.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vrp.c
Fixed on the mainline. pinskia, can you verify that as of comment #2 with the reduced and/or the original testcase? Thanks.
Subject: Bug 28187 Author: rguenth Date: Wed Jul 12 09:25:40 2006 New Revision: 115366 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115366 Log: 2006-07-12 Richard Guenther <rguenther@suse.de> PR tree-optimization/28187 * tree-vrp.c (vrp_operand_equal_p): New function. (vrp_bitmap_equal_p): Likewise. (update_value_range): Use them to compare old and new max and min values. * gcc.dg/pr28187.c: New testcase. Added: branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/pr28187.c Modified: branches/gcc-4_1-branch/gcc/ChangeLog branches/gcc-4_1-branch/gcc/testsuite/ChangeLog branches/gcc-4_1-branch/gcc/tree-vrp.c
Fixed.