public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/65673] Compound literal with initializer for zero-sized array drops other initializers Date: Fri, 17 Apr 2015 13:03:00 -0000 [thread overview] Message-ID: <bug-65673-4-q6KvhpIgNs@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-65673-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65673 --- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- What happens here is that pop_init_level returns error_mark_node because initializing a zero-length array member with {} is discarded: 7565 /* Silently discard empty initializations. The parser will 7566 already have pedwarned for empty brackets. */ 7567 if (integer_zerop (constructor_unfilled_index)) 7568 constructor_type = NULL_TREE; thus ret.value is NULL: 7718 if (ret.value == 0 && constructor_stack == 0) 7719 ret.value = error_mark_node; 7720 return ret; output_init_element then sees that value == error_mark_node, so it marks the ctor as erroneous: 8388 if (type == error_mark_node || value == error_mark_node) 8389 { 8390 constructor_erroneous = 1; 8391 return; 8392 } And because the ctor is erroneous, we don't build a CONSTRUCTOR for it: 7668 if (constructor_erroneous) 7669 ret.value = error_mark_node; 7670 else 7671 { 7672 ret.value = build_constructor (constructor_type, 7673 constructor_elements);
next prev parent reply other threads:[~2015-04-17 13:03 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-04-05 6:42 [Bug c/65673] New: " stilor at att dot net 2015-04-17 7:09 ` [Bug c/65673] " mpolacek at gcc dot gnu.org 2015-04-17 13:03 ` mpolacek at gcc dot gnu.org [this message] 2022-01-03 20:34 ` [Bug c/65673] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org 2022-01-17 15:19 ` rguenth at gcc dot gnu.org 2022-05-27 9:35 ` [Bug c/65673] [10/11/12/13 " rguenth at gcc dot gnu.org 2022-06-28 10:31 ` jakub at gcc dot gnu.org 2022-12-20 13:00 ` rguenth at gcc dot gnu.org 2023-01-31 1:29 ` luangruo at yahoo dot com 2023-07-07 10:30 ` [Bug c/65673] [11/12/13/14 " 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-65673-4-q6KvhpIgNs@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).