public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jcarbaut at hotmail dot fr" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/66370] New: compiler crashes when compiling a function with a huge number of arguments Date: Mon, 01 Jun 2015 21:58:00 -0000 [thread overview] Message-ID: <bug-66370-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66370 Bug ID: 66370 Summary: compiler crashes when compiling a function with a huge number of arguments Product: gcc Version: unknown Status: UNCONFIRMED Severity: minor Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: jcarbaut at hotmail dot fr Target Milestone: --- This happens with the mingw-w64 distribution on Windows 7, with gcc-4.9.2, 64 bits. I make a "fake" function with many arguments, with the following python script. The function computes the sum of its arguments, which are all of type long. The result is also of type long. The variable "n" in the python script is the number of arguments. The output is sent to a C file, which is then compiled. n = 10907 for i in [n]: print("long f(") s = "return" for j in range(1, 1 + i): if j == i: print(" long a%x) {" % j) s += " a%x;" % j print("%s\n}" % s) else: print(" long a%x," % j) s += " a%x + \n" % j With "gcc -c" (that is, no optimization), the compilation runs without a problem for n<28040 and crashes for n=28040 or larger. With "gcc -c -O1" or any higher level of optimization, the compilation runs for n<10907 and crashes for n=10907 or larger. While this function is utterly useless, it may show some bug in the compiler, since, I guess, it's not supposed to crash on weird input. It's a kind, a very trivial kind, of stress test for the compiler.
next reply other threads:[~2015-06-01 21:58 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-06-01 21:58 jcarbaut at hotmail dot fr [this message] 2015-06-02 9:03 ` [Bug rtl-optimization/66370] " 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-66370-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).