Attempting to compile the following function at -O3 on (at least) gcc 4.8.2 consumes all available memory: #include <stdint.h> #include <stddef.h> typedef struct giga { uint64_t g[0x10000000]; } giga; uint64_t addfst(giga const *gptr, size_t num) { uint64_t retval = 0; for (size_t i = 0; i < num; i++) { retval += gptr[i].g[0]; } return retval; }
A comment on http://stackoverflow.com/questions/29200652/gcc-consumes-all-memory-when-optimizing-o3 suggests -ftree-vectorize triggers the condition
Confirmed. else { for (i = 0; i < vec_num; i++) { and vec_num is 268435456 (after some time) ... looks uninitialized to me. (gdb) p group_size $21 = 268435456 for some reason we detect a grouped load with a single load and group size 268435456: t.c:9:3: note: === vect_analyze_data_ref_accesses === t.c:9:3: note: Detected single element interleaving _6->g[0] step 2147483648 t.c:9:3: note: Data access with gaps requires scalar epilogue loop
Fixed on trunk sofar.
Author: rguenth Date: Mon Mar 23 14:59:57 2015 New Revision: 221595 URL: https://gcc.gnu.org/viewcvs?rev=221595&root=gcc&view=rev Log: 2015-03-23 Richard Biener <rguenther@suse.de> PR tree-optimization/65518 * tree-vect-stmts.c (vectorizable_load): Reject single-element interleaving cases we generate absymal code for. * gcc.dg/vect/pr65518.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/vect/pr65518.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vect-stmts.c
Must be a regression, at least from the times when we didn't have any vectorizer.
Author: rguenth Date: Wed Jun 3 11:03:26 2015 New Revision: 224072 URL: https://gcc.gnu.org/viewcvs?rev=224072&root=gcc&view=rev Log: 2015-06-03 Richard Biener <rguenther@suse.de> Backport from mainline 2015-05-26 Michael Matz <matz@suse.de> PR middle-end/66251 * tree-vect-stmts.c (vect_create_vectorized_demotion_stmts): Always set STMT_VINFO_VEC_STMT, also with SLP. * gcc.dg/vect/pr66251.c: New test. 2015-05-22 Richard Biener <rguenther@suse.de> PR tree-optimization/66251 * tree-vect-stmts.c (vectorizable_conversion): Properly set STMT_VINFO_VEC_STMT even for the SLP case. * gfortran.fortran-torture/compile/pr66251.f90: New testcase. 2015-05-27 Richard Biener <rguenther@suse.de> PR tree-optimization/66272 Revert parts of 2014-08-15 Richard Biener <rguenther@suse.de> PR tree-optimization/62031 * tree-data-ref.c (dr_analyze_indices): Do not set DR_UNCONSTRAINED_BASE. (dr_may_alias_p): All indirect accesses have to go the formerly DR_UNCONSTRAINED_BASE path. * tree-data-ref.h (struct indices): Remove unconstrained_base member. (DR_UNCONSTRAINED_BASE): Remove. * gcc.dg/torture/pr66272.c: New testcase. 2015-05-13 Richard Biener <rguenther@suse.de> PR tree-optimization/66123 * tree-ssa-dom.c (propagate_rhs_into_lhs): Check if we found a taken edge. * gcc.dg/torture/pr66123.c: New testcase. 2015-06-02 Richard Biener <rguenther@suse.de> PR debug/65549 * dwarf2out.c (lookup_context_die): New function. (resolve_addr): Avoid forcing a full DIE for the target of a DW_TAG_GNU_call_site during late compilation. Instead create a stub DIE without a type if we have a context DIE present. * g++.dg/lto/pr65549_0.C: New testcase. 2015-03-23 Richard Biener <rguenther@suse.de> PR tree-optimization/65518 * tree-vect-stmts.c (vectorizable_load): Reject single-element interleaving cases we generate absymal code for. * gcc.dg/vect/pr65518.c: New testcase. Added: branches/gcc-4_9-branch/gcc/testsuite/g++.dg/lto/pr65549_0.C branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/torture/pr66123.c branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/torture/pr66272.c branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/vect/pr65518.c branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/vect/pr66251.c branches/gcc-4_9-branch/gcc/testsuite/gfortran.fortran-torture/compile/pr66251.f90 Modified: branches/gcc-4_9-branch/gcc/ChangeLog branches/gcc-4_9-branch/gcc/dwarf2out.c branches/gcc-4_9-branch/gcc/testsuite/ChangeLog branches/gcc-4_9-branch/gcc/tree-data-ref.c branches/gcc-4_9-branch/gcc/tree-data-ref.h branches/gcc-4_9-branch/gcc/tree-ssa-dom.c branches/gcc-4_9-branch/gcc/tree-vect-stmts.c
Author: rguenth Date: Wed Jun 3 13:50:11 2015 New Revision: 224081 URL: https://gcc.gnu.org/viewcvs?rev=224081&root=gcc&view=rev Log: 2015-06-03 Richard Biener <rguenther@suse.de> Backport from mainline 2015-05-26 Michael Matz <matz@suse.de> PR middle-end/66251 * tree-vect-stmts.c (vect_create_vectorized_demotion_stmts): Always set STMT_VINFO_VEC_STMT, also with SLP. * gcc.dg/vect/pr66251.c: New test. 2015-05-22 Richard Biener <rguenther@suse.de> PR tree-optimization/66251 * tree-vect-stmts.c (vectorizable_conversion): Properly set STMT_VINFO_VEC_STMT even for the SLP case. * gfortran.fortran-torture/compile/pr66251.f90: New testcase. 2015-03-23 Richard Biener <rguenther@suse.de> PR tree-optimization/65518 * tree-vect-stmts.c (vectorizable_load): Reject single-element interleaving cases we generate absymal code for. * gcc.dg/vect/pr65518.c: New testcase. 2015-05-13 Richard Biener <rguenther@suse.de> PR tree-optimization/66123 * tree-ssa-dom.c (propagate_rhs_into_lhs): Check if we found a taken edge. * gcc.dg/torture/pr66123.c: New testcase. 2015-05-27 Richard Biener <rguenther@suse.de> PR tree-optimization/66272 Revert parts of 2014-08-15 Richard Biener <rguenther@suse.de> PR tree-optimization/62031 * tree-data-ref.c (dr_analyze_indices): Do not set DR_UNCONSTRAINED_BASE. (dr_may_alias_p): All indirect accesses have to go the formerly DR_UNCONSTRAINED_BASE path. * tree-data-ref.h (struct indices): Remove unconstrained_base member. (DR_UNCONSTRAINED_BASE): Remove. * gcc.dg/torture/pr66272.c: New testcase. Added: branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr66123.c branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr66272.c branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/vect/pr65518.c branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/vect/pr66251.c branches/gcc-4_8-branch/gcc/testsuite/gfortran.fortran-torture/compile/pr66251.f90 Modified: branches/gcc-4_8-branch/gcc/ChangeLog branches/gcc-4_8-branch/gcc/testsuite/ChangeLog branches/gcc-4_8-branch/gcc/tree-data-ref.c branches/gcc-4_8-branch/gcc/tree-data-ref.h branches/gcc-4_8-branch/gcc/tree-ssa-dom.c branches/gcc-4_8-branch/gcc/tree-vect-stmts.c
Fixed.