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

            Bug ID: 58600
           Summary: [c++0x] ICE on wrong usage of 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++11") triggers an ICE
since GCC 4.8.0 (when alignas was introduced):

================================
namespace N {}
using namespace N alignas(int);
================================

bug.cc:2:30: internal compiler error: tree check: expected identifier_node,
have tree_list in private_is_attribute_p, at tree.c:5540
 using namespace N alignas(int);
                              ^
0xcd87ea tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9176
0xcd8b64 tree_check
        ../../gcc/gcc/tree.h:2819
0xcd8b64 private_is_attribute_p(char const*, unsigned long, tree_node const*)
        ../../gcc/gcc/tree.c:5540
0x6ff9ff is_attribute_p
        ../../gcc/gcc/tree.h:3678
0x6ff9ff parse_using_directive(tree_node*, tree_node*)
        ../../gcc/gcc/cp/name-lookup.c:3995
0x6545c2 cp_parser_using_directive
        ../../gcc/gcc/cp/parser.c:15951
0x6545c2 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10837
0x65cf1e cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10764
0x65bc8a cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10650
0x65d556 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x65d556 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28899
0x7709e3 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]

A slightly modified example crashes in a different location:

================================
namespace N {}
using namespace N alignas(X);
================================

bug.cc:2:27: error: 'X' was not declared in this scope
 using namespace N alignas(X);
                           ^
bug.cc:2:27: internal compiler error: tree check: expected tree_list, have
error_mark in parse_using_directive, at cp/name-lookup.c:3994
0xcd87ea tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9176
0x6ffabe tree_check
        ../../gcc/gcc/tree.h:2609
0x6ffabe parse_using_directive(tree_node*, tree_node*)
        ../../gcc/gcc/cp/name-lookup.c:3994
0x6545c2 cp_parser_using_directive
        ../../gcc/gcc/cp/parser.c:15951
0x6545c2 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10837
0x65cf1e cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10764
0x65bc8a cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10650
0x65d556 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x65d556 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28899
0x7709e3 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]

Reply via email to