Commit bf17fe3f by Eric Botcazou Committed by Eric Botcazou

utils2.c (gnat_protect_expr): Make a SAVE_EXPR only for fat pointer or scalar types.

	* gcc-interface/utils2.c (gnat_protect_expr): Make a SAVE_EXPR only
	for fat pointer or scalar types.

From-SVN: r233484
parent 244901a5
2016-02-17 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils2.c (gnat_protect_expr): Make a SAVE_EXPR only
for fat pointer or scalar types.
2016-02-16 Eric Botcazou <ebotcazou@adacore.com> 2016-02-16 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/gigi.h (maybe_debug_type): New inline function. * gcc-interface/gigi.h (maybe_debug_type): New inline function.
......
...@@ -2559,12 +2559,11 @@ gnat_protect_expr (tree exp) ...@@ -2559,12 +2559,11 @@ gnat_protect_expr (tree exp)
return build3 (code, type, gnat_protect_expr (TREE_OPERAND (exp, 0)), return build3 (code, type, gnat_protect_expr (TREE_OPERAND (exp, 0)),
TREE_OPERAND (exp, 1), TREE_OPERAND (exp, 2)); TREE_OPERAND (exp, 1), TREE_OPERAND (exp, 2));
/* If this is a fat pointer or something that can be placed in a register, /* If this is a fat pointer or a scalar, just make a SAVE_EXPR. Likewise
just make a SAVE_EXPR. Likewise for a CALL_EXPR as large objects are for a CALL_EXPR as large objects are returned via invisible reference
returned via invisible reference in most ABIs so the temporary will in most ABIs so the temporary will directly be filled by the callee. */
directly be filled by the callee. */
if (TYPE_IS_FAT_POINTER_P (type) if (TYPE_IS_FAT_POINTER_P (type)
|| TYPE_MODE (type) != BLKmode || !AGGREGATE_TYPE_P (type)
|| code == CALL_EXPR) || code == CALL_EXPR)
return save_expr (exp); return save_expr (exp);
......
2016-02-17 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/discr46.ad[sb]: New test.
2016-02-16 Kelvin Nilsen <kelvin@gcc.gnu.org> 2016-02-16 Kelvin Nilsen <kelvin@gcc.gnu.org>
PR Target/48344 PR Target/48344
......
-- { dg-do compile }
package body Discr46 is
function F (Id : Enum) return Integer is
Node : Integer := 0;
begin
if A (Id).R.D = True then
Node := A (Id).R.T;
end if;
return Node;
end;
end Discr46;
package Discr46 is
type Enum is (One, Two, Three);
for Enum use (One => 1, Two => 2, Three => 3);
type Rec1 (D : Boolean := False) is record
case D is
when False => null;
when True => T : Integer;
end case;
end record;
type Rec2 is record
R : Rec1;
C : Character;
end record;
type Arr is array (Enum) of Rec2;
A : Arr;
function F (Id : Enum) return Integer;
end Discr46;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment