[Bug c++/58584] New: [c++11] ICE with invalid argument for alignas

reichelt at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Sep 30 20:27:00 GMT 2013


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.]



More information about the Gcc-bugs mailing list