[Bug middle-end/77863] New: genmatch segfault on a wrong usage of an for operator

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Oct 5 11:44:00 GMT 2016


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

            Bug ID: 77863
           Summary: genmatch segfault on a wrong usage of an for operator
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
  Target Milestone: ---

Following snippet causes segfault (correct is to use just 'fn'):

(for fn (BUILT_IN_STRCMP BUILT_IN_STRCASECMP)
  (simplify
    (fn @0 @1)
    {
      (@fn == BUILT_IN_STRCASECMP ? @1 : @0);
    }))

Program received signal SIGSEGV, Segmentation fault.
0x0000000000407a53 in capture_info::walk_c_expr (this=0x7fffffffd720,
e=0x7d3520) at ../../gcc/genmatch.c:2197
2197              unsigned where = *e->capture_ids->get(id);
(gdb) bt
#0  0x0000000000407a53 in capture_info::walk_c_expr (this=0x7fffffffd720,
e=0x7d3520) at ../../gcc/genmatch.c:2197
#1  0x000000000040783e in capture_info::walk_result (this=0x7fffffffd720,
o=0x7d3520, conditional_p=false, result=0x7d3520) at ../../gcc/genmatch.c:2150
#2  0x0000000000406efe in capture_info::capture_info (this=0x7fffffffd720,
s=0xa0a160, result=0x7d3520, gimple_=true) at ../../gcc/genmatch.c:1997
#3  0x000000000040bfa3 in compare_op (o1=0x7d3520, s1=0xa0a160, o2=0x7d3520,
s2=0xa0a210) at ../../gcc/genmatch.c:3459
#4  0x00000000004178d2 in sinfo_hashmap_traits::equal_keys (v=@0xb0ea80:
0xb08320, candidate=@0x7fffffffd868: 0xb08510) at ../../gcc/genmatch.c:3489
#5  0x000000000041e075 in hash_map<void*, sinfo*,
sinfo_hashmap_traits>::hash_entry::equal (a=..., b=@0x7fffffffd868: 0xb08510)
at ../../gcc/hash-map.h:44
#6  0x000000000041b099 in hash_table<hash_map<void*, sinfo*,
sinfo_hashmap_traits>::hash_entry, xcallocator>::find_slot_with_hash
(this=0x7fffffffda10, comparable=@0x7fffffffd868: 0xb08510, hash=518938,
insert=INSERT) at ../../gcc/hash-table.h:891
#7  0x00000000004189e7 in hash_map<void*, sinfo*,
sinfo_hashmap_traits>::get_or_insert (this=0x7fffffffda10, k=@0x7fffffffd868:
0xb08510, existed=0x7fffffffd867) at ../../gcc/hash-map.h:161
#8  0x00000000004064b4 in dt_node::analyze (this=0xb08510, map=...) at
../../gcc/genmatch.c:1781
#9  0x0000000000406580 in dt_node::analyze (this=0xb08490, map=...) at
../../gcc/genmatch.c:1798
#10 0x0000000000406580 in dt_node::analyze (this=0xb08410, map=...) at
../../gcc/genmatch.c:1798
#11 0x0000000000406580 in dt_node::analyze (this=0xb083c0, map=...) at
../../gcc/genmatch.c:1798
#12 0x0000000000406580 in dt_node::analyze (this=0xa09bc0, map=...) at
../../gcc/genmatch.c:1798
#13 0x000000000040c222 in decision_tree::gen (this=0x7fffffffdae0,
f=0x7ffff7acf600 <_IO_2_1_stdout_>, gimple=true) at ../../gcc/genmatch.c:3501
#14 0x0000000000416605 in main (argc=3, argv=0x7fffffffdc98) at
../../gcc/genmatch.c:4875


More information about the Gcc-bugs mailing list