public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "reichelt at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58584] New: [c++11] ICE with invalid argument for alignas
Date: Mon, 30 Sep 2013 20:27:00 -0000	[thread overview]
Message-ID: <bug-58584-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58584

            Bug ID: 58584
           Summary: [c++11] ICE with invalid argument for alignas
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet (compiled with "-std=c++0x") triggers an ICE
since GCC 4.8.0 (when alignas was introduced):

========================
struct A
{
  int i alignas(this);
};
========================

bug.cc:3:17: error: invalid use of 'this' at top level
   int i alignas(this);
                 ^
bug.cc:3:17: internal compiler error: tree check: expected tree_list, have
error_mark in cp_check_const_attributes, at cp/decl2.c:1325
0xcd8a0a tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9176
0x6110cb tree_check
        ../../gcc/gcc/tree.h:2609
0x6110cb cp_check_const_attributes
        ../../gcc/gcc/cp/decl2.c:1325
0x6110cb cplus_decl_attributes(tree_node**, tree_node*, int)
        ../../gcc/gcc/cp/decl2.c:1351
0x6161b7 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
        ../../gcc/gcc/cp/decl2.c:989
0x636a92 cp_parser_member_declaration
        ../../gcc/gcc/cp/parser.c:20084
0x6376ce cp_parser_member_specification_opt
        ../../gcc/gcc/cp/parser.c:19630
0x6376ce cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:18885
0x63a070 cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:19101
0x63a070 cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:14080
0x64f549 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:11328
0x6535d9 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:10918
0x6555e0 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10867
0x65e5ee cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10764
0x65d35a cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10650
0x65ec36 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x65ec36 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28898
0x772143 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]

A template version of the code crashes in a different place:

========================
template<int> struct A
{
  int i alignas(this);
};
========================

neu50B.cc:3:17: error: invalid use of 'this' at top level
   int i alignas(this);
                 ^
neu50B.cc:3:17: internal compiler error: tree check: expected tree_list, have
error_mark in get_attribute_name, at attribs.c:659
0xcd8a0a tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9176
0x72a595 tree_check
        ../../gcc/gcc/tree.h:2819
0x72a595 get_attribute_name(tree_node const*)
        ../../gcc/gcc/attribs.c:659
0x610d23 is_late_template_attribute
        ../../gcc/gcc/cp/decl2.c:1120
0x610d23 splice_template_attributes
        ../../gcc/gcc/cp/decl2.c:1200
0x610d23 save_template_attributes
        ../../gcc/gcc/cp/decl2.c:1221
0x610d23 cplus_decl_attributes(tree_node**, tree_node*, int)
        ../../gcc/gcc/cp/decl2.c:1348
0x6161b7 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
        ../../gcc/gcc/cp/decl2.c:989
0x636a92 cp_parser_member_declaration
        ../../gcc/gcc/cp/parser.c:20084
0x6376ce cp_parser_member_specification_opt
        ../../gcc/gcc/cp/parser.c:19630
0x6376ce cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:18885
0x63a070 cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:19101
0x63a070 cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:14080
0x64f549 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:11328
0x653bb3 cp_parser_single_declaration
        ../../gcc/gcc/cp/parser.c:22578
0x656990 cp_parser_template_declaration_after_export
        ../../gcc/gcc/cp/parser.c:22454
0x65e789 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10728
0x65d35a cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10650
0x65ec36 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x65ec36 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28898
Please submit a full bug report, [etc.]


             reply	other threads:[~2013-09-30 20:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-30 20:27 reichelt at gcc dot gnu.org [this message]
2013-09-30 21:29 ` [Bug c++/58584] " paolo.carlini at oracle dot com
2013-10-01 11:46 ` mpolacek at gcc dot gnu.org
2013-10-01 11:47 ` mpolacek at gcc dot gnu.org
2013-10-03  0:25 ` paolo.carlini at oracle dot com
2013-10-03 22:51 ` paolo 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-58584-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: 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).