2015-03-31 13:42 GMT+02:00 Jakub Jelinek <ja...@redhat.com>: > On Tue, Mar 31, 2015 at 01:35:56PM +0200, Kai Tietz wrote: >> Hi, >> >> This patch avoids that we try to operate on function-decl's cfun equal >> to NULL within lower_emutls_function_body. > > If DECL_STRUCT_FUNCTION (node->decl) is already NULL (for which functions?), > then what is the point doing push_cfun/pop_cfun in that case at all? > Shouldn't you just early return if DECL_STRUCT_FUNCTION (node->decl) is > NULL?
In testcase for the function-decl "mpx_test" function-body is NULL. ... addressable used static QI file thread-local-var-1-lbv.c line 28 col 5 align 8 context <translation_unit_decl 0xffd19ab0 D.3888> attributes <tree_list 0xffcd9030> initial <block 0xfff806c8> result <result_decl 0xffd19a60 D.3886 type <integer_type 0xffdd0360 int> ignored SI file thread-local-var-1-lbv.c line 28 col 5 size <integer_cst 0xffef0558 32> unit size <integer_cst 0xffef0570 4> align 32 context <function_decl 0xffce4900 mpx_test>> chain <type_decl 0xffd05880 D.3315>> Fair point, so patch is: Index: tree-emutls.c =================================================================== --- tree-emutls.c (Revision 221789) +++ tree-emutls.c (Arbeitskopie) @@ -633,6 +633,9 @@ lower_emutls_function_body (struct cgraph_node *no struct lower_emutls_data d; bool any_edge_inserts = false; + if (!DECL_STRUCT_FUNCTION (node->decl)) + return; + push_cfun (DECL_STRUCT_FUNCTION (node->decl)); d.cfun_node = node;