92b6cb8bad0140a759e1038d54379e8d948427f6
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / gcc / 4.9.2 / 110-pr64896.patch
1 From fc39d7d6f0ac90086814306a43de38ad65c13f13 Mon Sep 17 00:00:00 2001
2 From: yroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4>
3 Date: Tue, 10 Mar 2015 19:20:30 +0000
4 Subject: [PATCH] gcc/ 2015-03-10  Yvan Roux  <yvan.roux@linaro.org>
5
6         Backport from trunk r220489.
7         2015-02-06  Jakub Jelinek  <jakub@redhat.com>
8
9         PR ipa/64896
10         * cgraphunit.c (cgraph_node::expand_thunk): If
11         restype is not is_gimple_reg_type nor the thunk_fndecl
12         returns aggregate_value_p, set restmp to a temporary variable
13         instead of resdecl.
14
15 gcc/testsuite/
16 2015-03-10  Yvan Roux  <yvan.roux@linaro.org>
17
18         Backport from trunk r220489.
19         2015-02-06  Jakub Jelinek  <jakub@redhat.com>
20
21         PR ipa/64896
22         * g++.dg/ipa/pr64896.C: New test.
23
24
25
26 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@221333 138bc75d-0d04-0410-961f-82ee72b054a4
27 ---
28  gcc/ChangeLog                      | 11 +++++++++++
29  gcc/cgraphunit.c                   | 11 ++++++++---
30  gcc/testsuite/ChangeLog            |  8 ++++++++
31  gcc/testsuite/g++.dg/ipa/pr64896.C | 29 +++++++++++++++++++++++++++++
32  4 files changed, 56 insertions(+), 3 deletions(-)
33  create mode 100644 gcc/testsuite/g++.dg/ipa/pr64896.C
34
35 diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
36 index 8f57607..130fc0d 100644
37 --- a/gcc/cgraphunit.c
38 +++ b/gcc/cgraphunit.c
39 @@ -1572,9 +1572,14 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks)
40             restmp = gimple_fold_indirect_ref (resdecl);
41           else if (!is_gimple_reg_type (restype))
42             {
43 -             restmp = resdecl;
44 -             add_local_decl (cfun, restmp);
45 -             BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp;
46 +             if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl)))
47 +               {
48 +                 restmp = resdecl;
49 +                 add_local_decl (cfun, restmp);
50 +                 BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp;
51 +               }
52 +             else
53 +               restmp = create_tmp_var (restype, "retval");
54             }
55           else
56             restmp = create_tmp_reg (restype, "retval");
57 -- 
58 1.8.1.4
59