Thank you very much for your prompt response, Rchard. Sorry I was kinda "learning by doing". I am familiar with LLVM stuff but newbie to GCC specifications.
Just want to make sure I got it right; _17 and _16 in the IR code are SSA variables. They are initialized for once and used once. Could you please shed some light on where "non-ssa name" comes in this scenario, and how exactly can I get _17 = (signed char *) _16 printed out? Thank you very much. Best, Shuai On Tue, Jun 16, 2020 at 12:52 AM Richard Biener <richard.guent...@gmail.com> wrote: > On June 15, 2020 6:31:38 PM GMT+02:00, Shuai Wang via Gcc <gcc@gcc.gnu.org> > wrote: > >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! > > Build your compiler with - - enable-checking and you'll figure you > reference SSA_NAME_DEF_STMT of a NON-SSA_NAME. I suggest you learn to use a > debugger. > > Richard. > > >Best, > >Shuai > >