This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch emutls]:Fix PR 65566
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 31 Mar 2015 14:21:23 +0200
- Subject: Re: [patch emutls]:Fix PR 65566
- Authentication-results: sourceware.org; auth=none
- References: <CAEwic4aocbKPFbUiWe6zJsSxNBS19XNnQSUveP_nr6SwuUk4vQ at mail dot gmail dot com> <20150331114212 dot GF2121 at tucnak dot redhat dot com>
2015-03-31 13:42 GMT+02:00 Jakub Jelinek <jakub@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;