https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64551

            Bug ID: 64551
           Summary: Segfault in target_opts_for_fn (from
                    ipa_icf::sem_function::equals_private)
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com
            Target: alpha-linux-gnu

Created attachment 34413
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34413&action=edit
Preprocessed source

Recently introduced problem.

Segfault can be triggered with attached testcase for --target=alpha-linux-gnu
configured crosscompiler:

~/gcc-build-alpha/gcc/cc1 -O2 -fpreprocessed -quiet -o aaa unwind-dw2.i

../../../gcc-svn/trunk/libgcc/unwind-dw2.c:1695:0: internal compiler error:
Segmentation fault
0xa7d66f crash_signal
        /home/uros/gcc-svn/trunk/gcc/toplev.c:366
0xed5757 tree_check
        /home/uros/gcc-svn/trunk/gcc/tree.h:2778
0xed5757 target_opts_for_fn
        /home/uros/gcc-svn/trunk/gcc/tree.h:4681
0xed5757 ipa_icf::sem_function::equals_private(ipa_icf::sem_item*,
hash_map<symtab_node*, ipa_icf::sem_item*, default_hashmap_traits>&)
        /home/uros/gcc-svn/trunk/gcc/ipa-icf.c:431
0xed6407 ipa_icf::sem_function::equals(ipa_icf::sem_item*,
hash_map<symtab_node*, ipa_icf::sem_item*, default_hashmap_traits>&)
        /home/uros/gcc-svn/trunk/gcc/ipa-icf.c:386
0xed4d1a ipa_icf::sem_item_optimizer::subdivide_classes_by_equality(bool)
        /home/uros/gcc-svn/trunk/gcc/ipa-icf.c:1893
0xed7466 ipa_icf::sem_item_optimizer::execute()
        /home/uros/gcc-svn/trunk/gcc/ipa-icf.c:1712
0xed74f1 ipa_icf_driver
        /home/uros/gcc-svn/trunk/gcc/ipa-icf.c:2441


gdb session:

Program received signal SIGSEGV, Segmentation fault.
target_opts_for_fn (fndecl=<optimized out>) at
/home/uros/gcc-svn/trunk/gcc/tree.h:4681
4681      return TREE_TARGET_OPTION (fn_opts);
(gdb) bt
#0  target_opts_for_fn (fndecl=<optimized out>) at
/home/uros/gcc-svn/trunk/gcc/tree.h:4681
#1  ipa_icf::sem_function::equals_private (this=0x151b080, item=<optimized
out>, ignored_nodes=...)
    at /home/uros/gcc-svn/trunk/gcc/ipa-icf.c:431
#2  0x0000000000ed6408 in ipa_icf::sem_function::equals (this=0x151b080,
item=0x0, ignored_nodes=...)
    at /home/uros/gcc-svn/trunk/gcc/ipa-icf.c:386
#3  0x0000000000ed4d1b in
ipa_icf::sem_item_optimizer::subdivide_classes_by_equality (this=0x1522370,
in_wpa=false)
    at /home/uros/gcc-svn/trunk/gcc/ipa-icf.c:1893
#4  0x0000000000ed7467 in ipa_icf::sem_item_optimizer::execute (this=0x1522370)
at /home/uros/gcc-svn/trunk/gcc/ipa-icf.c:1712
#5  0x0000000000ed74f2 in ipa_icf::ipa_icf_driver () at
/home/uros/gcc-svn/trunk/gcc/ipa-icf.c:2441
#6  0x00000000009bf8e3 in execute_one_pass (pass=0x14a9590) at
/home/uros/gcc-svn/trunk/gcc/passes.c:2311
#7  0x00000000009bfe16 in execute_ipa_pass_list (pass=0x14a9590) at
/home/uros/gcc-svn/trunk/gcc/passes.c:2708
#8  0x000000000068f79a in ipa_passes () at
/home/uros/gcc-svn/trunk/gcc/cgraphunit.c:2124
#9  symbol_table::compile (this=0x2aaaae7ad000) at
/home/uros/gcc-svn/trunk/gcc/cgraphunit.c:2212

fn_opts is NULL at the call site (line 4681).

(gdb) list
4676    target_opts_for_fn (const_tree fndecl)
4677    {
4678      tree fn_opts = DECL_FUNCTION_SPECIFIC_TARGET (fndecl);
4679      if (fn_opts == NULL_TREE)
4680        fn_opts = target_option_default_node;
4681      return TREE_TARGET_OPTION (fn_opts);
4682    }

Reply via email to