public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: Matthew Beliveau <mbelivea@redhat.com>
Cc: Jason Merrill <jason@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [C++ PATCH] PR c++/90590 Suppress warning for enumeration value not handled in switch warning
Date: Fri, 12 Jul 2019 23:00:00 -0000	[thread overview]
Message-ID: <20190712224930.GT5989@redhat.com> (raw)
In-Reply-To: <20190712183859.GQ5989@redhat.com>

On Fri, Jul 12, 2019 at 02:38:59PM -0400, Marek Polacek wrote:
> On Fri, Jul 12, 2019 at 02:34:37PM -0400, Matthew Beliveau wrote:
> > @@ -1628,6 +1629,16 @@ c_do_switch_warnings (splay_tree cases, location_t switch_location,
> >        if (cond && tree_int_cst_compare (cond, value))
> >  	continue;
> >  
> > +      /* If the enumerator is defined in a system header and uses a reserved
> > +	 name, then we continue to avoid throwing a warning.  */
> > +      location_t loc = DECL_SOURCE_LOCATION
> > +	    (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (type)));
> 
> As I mentioned before, I wonder if we can get away without the
> TYPE_MAIN_VARIANT here.

Ah, without TYPE_MAIN_VARIANT there's this ICEs:

/opt/notnfs/polacek/gcc/libstdc++-v3/src/c++11/debug.cc: In function ‘void {anonymous}::print_field({anonymous}::PrintContext&, const _Parameter&, const char*)’:
/opt/notnfs/polacek/gcc/libstdc++-v3/src/c++11/debug.cc:791:5: internal compiler error: Segmentation fault
  791 |     }
      |     ^
0xf31def crash_signal
        /opt/notnfs/polacek/gcc/gcc/toplev.c:326
0xaaa579 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*)
        /opt/notnfs/polacek/gcc/gcc/tree.h:3330
0xaaa579 c_do_switch_warnings(splay_tree_s*, unsigned int, tree_node*, tree_node*, bool)
        /opt/notnfs/polacek/gcc/gcc/c-family/c-warn.c:1634
0x8ab61f pop_switch()
        /opt/notnfs/polacek/gcc/gcc/cp/decl.c:3567
0x9e0af4 finish_switch_stmt(tree_node*)
        /opt/notnfs/polacek/gcc/gcc/cp/semantics.c:1229
0x95764d cp_parser_selection_statement
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:11964
0x95764d cp_parser_statement
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:11186
0x958770 cp_parser_statement_seq_opt
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:11667
0x958847 cp_parser_compound_statement
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:11621
0x971990 cp_parser_function_body
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:22651
0x971990 cp_parser_ctor_initializer_opt_and_function_body
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:22702
0x972216 cp_parser_function_definition_after_declarator
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:28016
0x972fae cp_parser_function_definition_from_specifiers_and_declarator
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:27932
0x972fae cp_parser_init_declarator
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:20288
0x954ecf cp_parser_simple_declaration
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:13546
0x9798a2 cp_parser_declaration
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:13243
0x97a46c cp_parser_declaration_seq_opt
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:13119
0x97a46c cp_parser_namespace_body
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:19335
0x97a46c cp_parser_namespace_definition
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:19313
0x9799b3 cp_parser_declaration
        /opt/notnfs/polacek/gcc/gcc/cp/parser.c:13223
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

So seems like we need it after all.  Sorry about that.

Marek

  reply	other threads:[~2019-07-12 22:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09 15:53 Matthew Beliveau
2019-07-09 17:48 ` Marek Polacek
2019-07-09 21:23 ` Jason Merrill
2019-07-12 18:39   ` Matthew Beliveau
2019-07-12 18:41     ` Marek Polacek
2019-07-12 23:00       ` Marek Polacek [this message]
2019-07-15 14:17         ` Matthew Beliveau
2019-07-16 12:42           ` Marek Polacek
2019-07-23 15:33             ` Matthew Beliveau
2019-07-30 19:46               ` Matthew Beliveau
2019-07-31 18:58           ` Jason Merrill

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=20190712224930.GT5989@redhat.com \
    --to=polacek@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=mbelivea@redhat.com \
    /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: link
Be 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).