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

            Bug ID: 59947
           Summary: Segmentation fault with #pragma GCC optimize ("O2")
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: timshen at gcc dot gnu.org

The following piece of code causes a gcc segmentation fault:

// test.cc
#pragma GCC optimize ("O2")
#include <regex>
template class std::basic_regex<char>;


The backtrace info:

~ # /usr/local/bin/g++ -std=c++11 test.cc
In file included from /usr/local/include/c++/4.9.0/bits/basic_ios.h:37:0,
                 from /usr/local/include/c++/4.9.0/ios:44,
                 from /usr/local/include/c++/4.9.0/ostream:38,
                 from /usr/local/include/c++/4.9.0/iterator:64,
                 from /usr/local/include/c++/4.9.0/regex:44,
                 from test.cc:2:
/usr/local/include/c++/4.9.0/bits/locale_facets.h: In member function ‘char
std::ctype<char>::narrow(std::ctype<char>::char_type, char) const’:
/usr/local/include/c++/4.9.0/bits/locale_facets.h:927:42: internal compiler
error: Segmentation fault
  const char __t = do_narrow(__c, __dfault);
                                          ^
0xb8afaf crash_signal
    /home/root/src/gcc/gcc/toplev.c:337
0xa0c5a1 hash_table<odr_hasher, xcallocator>::find_slot_with_hash(tree_node
const*, unsigned int, insert_option)
    /home/root/src/gcc/gcc/hash-table.h:774
0xa097bc get_odr_type(tree_node*, bool)
    /home/root/src/gcc/gcc/ipa-devirt.c:413
0xa0b0a4 possible_polymorphic_call_targets(tree_node*, long,
ipa_polymorphic_call_context, bool*, void**)
    /home/root/src/gcc/gcc/ipa-devirt.c:1242
0x9c8774 possible_polymorphic_call_targets(tree_node*, bool*, void**)
    /home/root/src/gcc/gcc/ipa-utils.h:135
0x9c5a83 gimple_fold_call
    /home/root/src/gcc/gcc/gimple-fold.c:1193
0x9c5a83 fold_stmt_1
    /home/root/src/gcc/gcc/gimple-fold.c:1306
0x9e643f gimplify_modify_expr
    /home/root/src/gcc/gcc/gimplify.c:4582
0x9dab3b gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    /home/root/src/gcc/gcc/gimplify.c:7441
0x9debf6 gimplify_stmt(tree_node**, gimple_statement_base**)
    /home/root/src/gcc/gcc/gimplify.c:5334
0x9da393 gimplify_cleanup_point_expr
    /home/root/src/gcc/gcc/gimplify.c:5110
0x9da393 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    /home/root/src/gcc/gcc/gimplify.c:7804
0x9debf6 gimplify_stmt(tree_node**, gimple_statement_base**)
    /home/root/src/gcc/gcc/gimplify.c:5334
0x9dad83 gimplify_statement_list
    /home/root/src/gcc/gcc/gimplify.c:1405
0x9dad83 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    /home/root/src/gcc/gcc/gimplify.c:7856
0x9debf6 gimplify_stmt(tree_node**, gimple_statement_base**)
    /home/root/src/gcc/gcc/gimplify.c:5334
0x9df862 gimplify_bind_expr
    /home/root/src/gcc/gcc/gimplify.c:1072
0x9da849 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    /home/root/src/gcc/gcc/gimplify.c:7638
0x9debf6 gimplify_stmt(tree_node**, gimple_statement_base**)
    /home/root/src/gcc/gcc/gimplify.c:5334
0x9e03a9 gimplify_body(tree_node*, bool)
    /home/root/src/gcc/gcc/gimplify.c:8548
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


My gcc is trunk@207098.

Thanks!

Reply via email to