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

            Bug ID: 78650
           Summary: ira-costs.c:1716:53: runtime error: member access
                    within null pointer of type 'struct cost_classes'
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
  Target Milestone: ---
            Target: powerpc64le-unknown-linux-gnu

On ppc64le I get:

 % cat test.i
void foo() {}

 % /home/trippels/gcc_ubsan_clang/usr/local/bin/gcc -c -O3 test.i
../../gcc/gcc/ira-costs.c:1716:53: runtime error: member access within null
pointer of type 'struct cost_classes'


(gdb) b __ubsan::Diag::~Diag
Breakpoint 1 at 0x101f7f38: file
/home/trippels/llvm/projects/compiler-rt/lib/ubsan/ubsan_diag.cc, line 335.
(gdb) run
...
(gdb) up
#1  0x00000000101fbb34 in handleTypeMismatchImpl (Data=<optimized out>,
Pointer=0, Opts=...) at
/home/trippels/llvm/projects/compiler-rt/lib/ubsan/ubsan_handlers.cc:71
71          Diag(Loc, DL_Error, "%0 null pointer of type %1")
(gdb) up
#2  0x000000001133727c in find_costs_and_classes (dump_file=<optimized out>) at
../../gcc/gcc/ira-costs.c:1716
1716              enum reg_class *cost_classes = cost_classes_ptr->classes;
(gdb) l
1711              int rclass, a_num, parent_a_num, add_cost;
1712              ira_loop_tree_node_t parent;
1713              int best_cost, allocno_cost;
1714              enum reg_class best, alt_class;
1715              cost_classes_t cost_classes_ptr = regno_cost_classes[i];
1716              enum reg_class *cost_classes = cost_classes_ptr->classes;
1717              int *i_costs = temp_costs->cost;
1718              int i_mem_cost;
1719              int equiv_savings = regno_equiv_gains[i];
1720
(gdb) p i
$1 = 154
(gdb) p  max_reg_num () - 1
$2 = 154
(gdb) p regno_cost_classes[154]
$3 = (cost_classes *) 0x0

Reply via email to