[Bug c++/60211] New: ICE with #pragma GCC ivdep and for-loop on global scope

reichelt at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Feb 15 12:11:00 GMT 2014


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

            Bug ID: 60211
           Summary: ICE with #pragma GCC ivdep and for-loop on global
                    scope
           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 triggers an ICE on trunk:

=================================
void foo()
{}
  int i;
#pragma GCC ivdep
  for (i = 0; i < 2; ++i)
    ;
}
=================================

bug.cc:6:5: internal compiler error: in add_stmt, at cp/semantics.c:391
     ;
     ^
0x7268a8 add_stmt(tree_node*)
        ../../gcc/gcc/cp/semantics.c:391
0x6d0457 cp_parser_iteration_statement
        ../../gcc/gcc/cp/parser.c:10516
0x6a7600 cp_parser_pragma
        ../../gcc/gcc/cp/parser.c:31461
0x6d2c51 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10864
0x6d44ba cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4014
0x6d44ba c_parse_file()
        ../../gcc/gcc/cp/parser.c:31536
0x7f3823 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1060
Please submit a full bug report, [etc.]


Declaring the variable within the for-loop produces a different stack trace:

=================================
void foo()
{}
#pragma GCC ivdep
  for (int i = 0; i < 2; ++i)
    ;
}
=================================

bug.cc:4:12: internal compiler error: tree check: expected tree that contains
'decl with visibility' structure, have 'parm_decl' in start_decl, at
cp/decl.c:4572
   for (int i = 0; i < 2; ++i)
            ^
0xdc0f24 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ../../gcc/gcc/tree.c:9364
0x5ee658 contains_struct_check
        ../../gcc/gcc/tree.h:2823
0x5ee658 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc/gcc/cp/decl.c:4572
0x6c7efe cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16680
0x6c9989 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:11205
0x6d02bd cp_parser_for_init_statement
        ../../gcc/gcc/cp/parser.c:10558
0x6d02bd cp_parser_for
        ../../gcc/gcc/cp/parser.c:10038
0x6d02bd cp_parser_iteration_statement
        ../../gcc/gcc/cp/parser.c:10505
0x6a7600 cp_parser_pragma
        ../../gcc/gcc/cp/parser.c:31461
0x6d2c51 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10864
0x6d44ba cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4014
0x6d44ba c_parse_file()
        ../../gcc/gcc/cp/parser.c:31536
0x7f3823 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1060
Please submit a full bug report, [etc.]



More information about the Gcc-bugs mailing list