https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117291
Bug ID: 117291 Summary: Simple but large test case uses up over 8M of stack and hits SEGV Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: bergner at gcc dot gnu.org Target Milestone: --- Compiling the attached simple but large test case, we seem to run out of stack space which causes an ICE. The test case declares 70K global variables and the function just returns the sum of them all. I'm not sure whether we consider this a bug or not, but thought I'd report to see what others think. Is running out of 8M of stack space in the compiler a bug or not? bergner@ltcden2-lp1:ICE$ ulimit -s 8192 bergner@ltcden2-lp1:ICE$ /opt/gcc-nightly/trunk/bin/gcc -S test.c gcc: internal compiler error: Segmentation fault signal terminated program cc1 Please submit a full bug report, with preprocessed source (by using -freport-bug). See <https://gcc.gnu.org/bugs/> for instructions. bergner@ltcden2-lp1:ICE$ ulimit -s unlimited bergner@ltcden2-lp1:ICE$ /opt/gcc-nightly/trunk/bin/gcc -S test.c bergner@ltcden2-lp1:ICE$ The gdb backtrace looks like: #0 0x00000000108e9274 in IS_ADHOC_LOC (loc=0) at /home/bergner/gcc/gcc-fsf-mainline-base/gcc/../libcpp/include/line-map.h:589 #1 0x00000000138c6cb4 in get_location_from_adhoc_loc (set=0x7ffff7f50000, loc=2147524555) at /home/bergner/gcc/gcc-fsf-mainline-base/libcpp/line-map.cc:312 #2 0x0000000011f03a94 in get_nowarn_spec (expr=<plus_expr 0x7fffd83acd50>) at /home/bergner/gcc/gcc-fsf-mainline-base/gcc/warning-control.cc:92 #3 0x0000000011f03ca8 in warning_suppressed_p (expr=<plus_expr 0x7fffd83acd50>, opt=OPT_Woverflow) at /home/bergner/gcc/gcc-fsf-mainline-base/gcc/warning-control.cc:123 #4 0x00000000109e2970 in c_fully_fold_internal (expr=<plus_expr 0x7fffd83acd50>, in_init=false, maybe_const_operands=0x7fffffffd9d4, maybe_const_itself=0x7fffffffd9d5, for_int_const=false, lval=false) at /home/bergner/gcc/gcc-fsf-mainline-base/gcc/c/c-fold.cc:158 #5 0x00000000109e3b20 in c_fully_fold_internal (expr=<plus_expr 0x7fffd83acd78>, in_init=false, maybe_const_operands=0x7fffffffd9d4, maybe_const_itself=0x7fffffffd9d5, for_int_const=false, lval=false) at /home/bergner/gcc/gcc-fsf-mainline-base/gcc/c/c-fold.cc:355 #6 0x00000000109e3b20 in c_fully_fold_internal (expr=<plus_expr 0x7fffd83acda0>, in_init=false, maybe_const_operands=0x7fffffffd9d4, maybe_const_itself=0x7fffffffd9d5, for_int_const=false, lval=false) at /home/bergner/gcc/gcc-fsf-mainline-base/gcc/c/c-fold.cc:355 #7 0x00000000109e3b20 in c_fully_fold_internal (expr=<plus_expr 0x7fffd83acdc8>, in_init=false, maybe_const_operands=0x7fffffffd9d4, maybe_const_itself=0x7fffffffd9d5, for_int_const=false, lval=false) at /home/bergner/gcc/gcc-fsf-mainline-base/gcc/c/c-fold.cc:355 ...