public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "austern at apple dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/11228] New: ICE on new-expression using array operator new and default-initialization Date: Tue, 17 Jun 2003 23:15:00 -0000 [thread overview] Message-ID: <20030617231527.11228.austern@apple.com> (raw) PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11228 Summary: ICE on new-expression using array operator new and default-initialization Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: austern@apple.com CC: gcc-bugs@gcc.gnu.org GCC build triplet: i686-pc-linux-gnu/ GCC host triplet: i686-pc-linux-gnu/ GCC target triplet: i686-pc-linux-gnu/ Compile the following translation unit with 3.3: struct MDSWeight { }; void foo(int numWeights) { new MDSWeight[numWeights](); } If the compiler is configured with --enable-checking, this causes an internal compiler error: foo.cc:5: internal compiler error: tree check: expected integer_cst, have non_lvalue_expr in tree_int_cst_lt, at tree.c:3180 If the compiler is configured without checking the behavior is even less friendly: an infinite loop, with the compiler allocating more and more memory. I believe that the code above is legal. (Although admittedly it would be more natural not to write the parentheses.) The syntax of a new-expression is given in clause 5.3.4, paragraph 1. "MDSWeight[numWeights]" is a new-type-id ("MDSWeight" is a type-specifier-seq and "[numWeights]" is a direct-new-declarator. "()" is a valid new-initializer. Clause 5.3.4, paragraph 15, describes the semantics of the new-initializer, referring to clause 8.5. Nothing in 5.3.4/15 or 8.5 suggests that it's illegal to explicitly request default initialization when using array operator new. Note that the ICE is a regression from 2.95 (which accepts this construct) and from 3.1/3.2 (which reject it with an error).
next reply other threads:[~2003-06-17 23:15 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-06-17 23:15 austern at apple dot com [this message] 2003-06-17 23:57 ` [Bug c++/11228] [3.3/3.4 regression] " bangerth at dealii dot org 2003-06-18 0:07 ` austern at apple dot com 2003-06-18 0:29 ` bangerth at dealii dot org 2003-06-18 4:34 ` austern at apple dot com 2003-06-19 4:27 ` austern at apple dot com 2003-06-20 0:29 ` cvs-commit at gcc dot gnu dot org 2003-06-20 0:34 ` cvs-commit at gcc dot gnu dot org 2003-06-20 19:17 ` austern at apple dot com 2003-07-19 17:36 ` dank at kegel dot com 2003-08-06 17:58 ` pinskia at physics dot uc dot edu 2003-08-06 19:37 ` pdubuc at cas dot org 2003-08-06 19:39 ` pinskia at physics dot uc dot edu
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=20030617231527.11228.austern@apple.com \ --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).