public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "enkovich.gnu at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/62034] New: ICE for big statically initialized arrays compiled with LTO Date: Wed, 06 Aug 2014 11:02:00 -0000 [thread overview] Message-ID: <bug-62034-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62034 Bug ID: 62034 Summary: ICE for big statically initialized arrays compiled with LTO Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: enkovich.gnu at gmail dot com Created attachment 33259 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33259&action=edit Reproducer I get ICE when try to compile tests with big amount of statically initialized data. gcc --version gcc (GCC) 4.10.0 20140806 (experimental) Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. gcc -flto test.c gcc: internal compiler error: Segmentation fault (program lto1) 0x405c80 execute ../../gcc-ref/gcc/gcc.c:2900 0x409fe9 do_spec_1 ../../gcc-ref/gcc/gcc.c:4704 0x40d475 process_brace_body ../../gcc-ref/gcc/gcc.c:5987 0x40d2b1 handle_braces ../../gcc-ref/gcc/gcc.c:5901 0x40bf9d do_spec_1 ../../gcc-ref/gcc/gcc.c:5358 0x40d475 process_brace_body ../../gcc-ref/gcc/gcc.c:5987 0x40d2b1 handle_braces ../../gcc-ref/gcc/gcc.c:5901 0x40bf9d do_spec_1 ../../gcc-ref/gcc/gcc.c:5358 0x40c38c do_spec_1 ../../gcc-ref/gcc/gcc.c:5473 0x40d475 process_brace_body ../../gcc-ref/gcc/gcc.c:5987 0x40d2b1 handle_braces ../../gcc-ref/gcc/gcc.c:5901 0x40bf9d do_spec_1 ../../gcc-ref/gcc/gcc.c:5358 0x409664 do_spec_2 ../../gcc-ref/gcc/gcc.c:4405 0x409582 do_spec(char const*) ../../gcc-ref/gcc/gcc.c:4372 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: fatal error: gcc-ref-build/bin/gcc returned 4 exit status compilation terminated. /usr/bin/ld: lto-wrapper failed collect2: error: ld returned 1 exit status Debugger shows that problem appears when lto_input_tree tries to dig through a bunch of SCC entries in input stream. Each SCC entry cause two new functions (lto_input_tree and lto_input_tree_1) in the call stack. With many consequent SCC entries stack may grow too much (in my case compiler segfaulted with ~600 000 entries in the call stack). Attached test has a statically initialized array with a million elements. Bigger data set may be required to break the compiler if you use increased stack size. Problem appeared after this commit: https://gcc.gnu.org/ml/gcc-cvs/2014-07/msg00291.html Following patch removing recursion helps me to compile my tests: diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 698f926..25657da 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1345,7 +1345,16 @@ lto_input_tree_1 (struct lto_input_block *ib, struct data_in *data_in, tree lto_input_tree (struct lto_input_block *ib, struct data_in *data_in) { - return lto_input_tree_1 (ib, data_in, streamer_read_record_start (ib), 0); + enum LTO_tags tag; + + /* Skip SCC entries. */ + while ((tag = streamer_read_record_start (ib)) == LTO_tree_scc) + { + unsigned len, entry_len; + lto_input_scc (ib, data_in, &len, &entry_len); + } + + return lto_input_tree_1 (ib, data_in, tag, 0); } Did not fully test this patch yet.
next reply other threads:[~2014-08-06 11:02 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-08-06 11:02 enkovich.gnu at gmail dot com [this message] 2014-08-06 12:13 ` [Bug lto/62034] " rguenth at gcc dot gnu.org 2014-08-06 12:16 ` rguenth at gcc dot gnu.org 2014-08-06 12:37 ` rguenth at gcc dot gnu.org 2014-08-06 13:53 ` rguenth at gcc dot gnu.org 2014-08-06 13:56 ` rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-62034-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).