diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-01-23 11:07:56 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-01-23 11:07:56 +0000 |
commit | 39791fb62f536e77e0c4bc6bf2fdc6f2bcdf7f05 (patch) | |
tree | 5febf9df2afc9efe3f7010a454a9c820322a53c4 /gcc | |
parent | b3e5901b625df90e3618b2e5a06cccc36cd84b6a (diff) | |
download | gcc-39791fb62f536e77e0c4bc6bf2fdc6f2bcdf7f05.zip gcc-39791fb62f536e77e0c4bc6bf2fdc6f2bcdf7f05.tar.gz gcc-39791fb62f536e77e0c4bc6bf2fdc6f2bcdf7f05.tar.bz2 |
cgraphunit.c (cgraph_node::expand_thunk): When expanding a GIMPLE thunk that returns by reference...
* cgraphunit.c (cgraph_node::expand_thunk): When expanding a GIMPLE
thunk that returns by reference, use the type of the return object
of the thunk instead of that of the alias to build the dereference.
From-SVN: r268182
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cgraphunit.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/specs/opt4.ads | 25 |
4 files changed, 37 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f1522be..ef29cb0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-01-23 Eric Botcazou <ebotcazou@adacore.com> + + * cgraphunit.c (cgraph_node::expand_thunk): When expanding a GIMPLE + thunk that returns by reference, use the type of the return object + of the thunk instead of that of the alias to build the dereference. + 2019-01-23 Vineet Gupta <vgupta@synopsys.com> * config/arc/atomic.md: Add operand to DMB instruction. diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 1cf9ac5..a7c9b9a 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1916,10 +1916,9 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk) restmp = gimple_fold_indirect_ref (resdecl); if (!restmp) restmp = build2 (MEM_REF, - TREE_TYPE (TREE_TYPE (DECL_RESULT (alias))), + TREE_TYPE (TREE_TYPE (resdecl)), resdecl, - build_int_cst (TREE_TYPE - (DECL_RESULT (alias)), 0)); + build_int_cst (TREE_TYPE (resdecl), 0)); } else if (!is_gimple_reg_type (restype)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 164c9bc..b1ad372 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-01-23 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/specs/opt4.ads: New test. + 2019-01-23 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/88964 diff --git a/gcc/testsuite/gnat.dg/specs/opt4.ads b/gcc/testsuite/gnat.dg/specs/opt4.ads new file mode 100644 index 0000000..b391950 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/opt4.ads @@ -0,0 +1,25 @@ +-- { dg-do compile } +-- { dg-options "-O" } + +package Opt4 is + + type Rec (D : Boolean := False) is record + case D is + when False => null; + when True => I : Integer; + end case; + end record; + + Null_Rec : constant Rec := (D => False); + + type I1 is limited interface; + + type I2 is limited interface; + + function Func (Data : I2) return Rec is abstract; + + type Ext is limited new I1 and I2 with null record; + + overriding function Func (Data : Ext) return Rec is (Null_Rec); + +end Opt4; |