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

            Bug ID: 57548
           Summary: calling gnu multiversioned function at file scope
                    causes ICE
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mib.bugzilla at gmail dot com

/rdrive/ref/gcc/bin/g++48 -c mv1.cpp
mv1.cpp:28:13: internal compiler error: Segmentation fault
 int j = fum();
             ^
0x84eaa07 crash_signal
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/toplev.c:332
0x868bd44 ix86_can_inline_p
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/config/i386/i386.c:4498
0x8102760 build_over_call
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/call.c:7044
0x8106154 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/call.c:3918
0x81bbdef finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**,
bool, bool, int)
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/semantics.c:2220
0x8176dd7 cp_parser_postfix_expression
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/parser.c:5855
0x8178a82 cp_parser_unary_expression
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/parser.c:6729
0x8179532 cp_parser_binary_expression
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/parser.c:7421
0x8179ab0 cp_parser_assignment_expression
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/parser.c:7657
0x8179f29 cp_parser_assignment_expression
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/parser.c:7707
0x8179f29 cp_parser_constant_expression
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/parser.c:7917
0x818303a cp_parser_init_declarator
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/parser.c:16095
0x8184d49 cp_parser_simple_declaration
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/parser.c:10670
0x81726d6 cp_parser_block_declaration
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/parser.c:10551
0x818c2b4 cp_parser_declaration
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/parser.c:10448
0x818c676 cp_parser_declaration_seq_opt
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/parser.c:10334
0x818cac4 cp_parser_translation_unit
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/parser.c:3813
0x818cac4 c_parse_file()
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/cp/parser.c:28338
0x8227d5a c_common_parse_file()
       
/rusers/sys_cron/grab_gcc/downloads_rel/4.8.1/gcc-4.8.1/gcc/c-family/c-opts.c:1046
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. 

Test case:

int fum (); // Extra declaration that is merged with the second one.
int fum () __attribute__ ((target("default")));

#if 0
// gcc doesn't recognize cmov
int fum () __attribute__((target( "cmov")));
#endif
int fum () __attribute__((target( "mmx")));
int fum () __attribute__((target( "popcnt")));
int fum () __attribute__((target( "sse")));
int fum () __attribute__((target( "sse2")));
int fum () __attribute__((target( "sse3")));
int fum () __attribute__((target( "ssse3")));
int fum () __attribute__((target( "sse4.1")));
int fum () __attribute__((target( "sse4.2")));
int fum () __attribute__((target( "avx")));
int fum () __attribute__((target( "avx2")));

int fum () __attribute__((target("arch=core2")));
int fum () __attribute__((target("arch=corei7")));
int fum () __attribute__((target("arch=atom")));

int (*p)() = &fum;


int j = fum();

Reply via email to