Hello Shubham, Thank you for the reply! I see. That's strange, the `f` pointer turns out to be invalid. May I ask when would the corresponding struct be initialized? And I am attaching the corresponding GIMPLE IR code. As you can see, I am traversing to the following statement: r_9 = foo (a_6, d_2); And trigger the above procedure. Function `foo` has been traversed before this statement which means the corresponding function* should have been created already? Best, Shuai On Tue, Feb 16, 2021 at 9:23 PM Shubham Narlawar wrote: > > > On Tue, 16 Feb, 2021, 5:55 PM Shuai Wang via Gcc, wrote: > >> Thank you for your reply! >> >> I tried to use this in the following code: >> >> tree func_decl = gimple_call_fndecl(stmt); // stmt is the function call >> statement >> function* f = DECL_STRUCT_FUNCTION(func_decl); >> std::cerr << get_name(f->decl) << std::endl; >> >> However, it seems the last line throws an exception as follows: >> >> during GIMPLE pass: XXX // here XXX is my pass name >> internal compiler error: Segmentation fault >> > > Hi, > > Check whether f is a valid function pointer or not. It seems the function > is inlined. You can verify it with -fno-inline. > > Macros defined in tree.h are helpful to get a broader view of the problem. > > Shubham > > ... >> >> That seems strange. Does that seem familiar to you by any chance? Thank >> you! >> >> Best, >> Shuai >> >> >> >> On Tue, Feb 16, 2021 at 7:52 PM Martin Liška wrote: >> >> > On 2/16/21 9:51 AM, Shuai Wang via Gcc wrote: >> > > However, can I proceed further to get the function* of "foo"? I >> checked >> > >> > Hello. >> > >> > Yes, you can call DECL_STRUCT_FUNCTION(func_decl). >> > >> > Martin >> > >> >