On Tue, 16 Feb, 2021, 5:55 PM Shuai Wang via Gcc, <gcc@gcc.gnu.org> 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 <mli...@suse.cz> 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
> >
>

Reply via email to