Message ID | 046b6034-0c76-c683-f156-2540bbf40eea@suse.cz |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
On Sat, Feb 20, 2021 at 11:49 AM Martin Liška <mliska@suse.cz> wrote: > > After g:1a2a7096e5e20d736c6138179470b21aa5a74864 we forbid inlining > for a VLA types. What we miss is setting inline_forbidden_reason > variable. > > Fixes: > > ./xgcc -B. -O3 -c /home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/pr99122-2.c -Winline > > during GIMPLE pass: local-fnsummary > /home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/pr99122-2.c: In function ‘foo’: > /home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/pr99122-2.c:21:1: internal compiler error: Segmentation fault > 21 | } > | ^ > 0xe8b2ca crash_signal > /home/marxin/Programming/gcc/gcc/toplev.c:327 > 0x1a92733 pp_format(pretty_printer*, text_info*) > /home/marxin/Programming/gcc/gcc/pretty-print.c:1096 > 0x1a76b90 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) > /home/marxin/Programming/gcc/gcc/diagnostic.c:1244 > 0x1a79994 diagnostic_impl > /home/marxin/Programming/gcc/gcc/diagnostic.c:1406 > 0x1a79994 warning(int, char const*, ...) > /home/marxin/Programming/gcc/gcc/diagnostic.c:1527 > 0xf1bb16 tree_inlinable_function_p(tree_node*) > /home/marxin/Programming/gcc/gcc/tree-inline.c:4123 > 0xc3f1c5 compute_fn_summary(cgraph_node*, bool) > /home/marxin/Programming/gcc/gcc/ipa-fnsummary.c:3110 > 0xc3f937 compute_fn_summary_for_current > /home/marxin/Programming/gcc/gcc/ipa-fnsummary.c:3160 > 0xc3f937 execute > /home/marxin/Programming/gcc/gcc/ipa-fnsummary.c:4768 > > Ready to be installed? OK. > Thanks, > Martin > > gcc/ChangeLog: > > * tree-inline.c (inline_forbidden_p): Set > inline_forbidden_reason. > --- > gcc/tree-inline.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c > index c993b1fee8a..1dcb31c0267 100644 > --- a/gcc/tree-inline.c > +++ b/gcc/tree-inline.c > @@ -4027,10 +4027,20 @@ inline_forbidden_p (tree fndecl) > the caller. */ > if (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl))) > && !poly_int_tree_p (TYPE_SIZE (TREE_TYPE (TREE_TYPE (fndecl))))) > - return true; > + { > + inline_forbidden_reason > + = G_("function %q+F can never be inlined because " > + "it has a VLA return argument"); > + return true; > + } > for (tree parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm)) > if (!poly_int_tree_p (DECL_SIZE (parm))) > - return true; > + { > + inline_forbidden_reason > + = G_("function %q+F can never be inlined because " > + "it has a VLA argument"); > + return true; > + } > > FOR_EACH_BB_FN (bb, fun) > { > -- > 2.30.1 >
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index c993b1fee8a..1dcb31c0267 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -4027,10 +4027,20 @@ inline_forbidden_p (tree fndecl) the caller. */ if (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl))) && !poly_int_tree_p (TYPE_SIZE (TREE_TYPE (TREE_TYPE (fndecl))))) - return true; + { + inline_forbidden_reason + = G_("function %q+F can never be inlined because " + "it has a VLA return argument"); + return true; + } for (tree parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm)) if (!poly_int_tree_p (DECL_SIZE (parm))) - return true; + { + inline_forbidden_reason + = G_("function %q+F can never be inlined because " + "it has a VLA argument"); + return true; + } FOR_EACH_BB_FN (bb, fun) {