Hello,

Suppose given the following SSA statement generated by the `sanopt` pass:

   _17 = (signed char *) _16;
   _18 = *_17;

I am using the following code to identify that _17 depends on _16:

// def_stmt refers to _18 = &_17;
for (unsigned i = 1; i < gimple_num_ops(def_stmt); i++) {
         op1 = gimple_assign_rhs1(def_stmt);
         if (is_gimple_addressable(op1)) {
              gimple* def_stmt = SSA_NAME_DEF_STMT(op1);
              print_gimple_stmt(stderr, def_stmt, 0, TDF_SLIM); // crash at
this point
         }

It crashes with the following call stack:

0xb5cd5f crash_signal
        ../../gcc-10.1.0/gcc/toplev.c:328
0x1452134 pp_format(pretty_printer*, text_info*)
        ../../gcc-10.1.0/gcc/pretty-print.c:1828
0x14533e4 pp_printf(pretty_printer*, char const*, ...)
        ../../gcc-10.1.0/gcc/pretty-print.c:1773
0x8dcc81 print_gimple_stmt(_IO_FILE*, gimple*, int, dump_flag)
        ../../gcc-10.1.0/gcc/gimple-pretty-print.c:157

I tried hard but just cannot understand why this would crash. Indeed, this
code works pretty well when printing out other dependency statements, but
just gets stuck in front of pointer dereference like _18 = *_17.

Any suggestion would be appreciated. Thank you!

Best,
Shuai

Reply via email to