Commit 4a582c9f by Eric Botcazou Committed by Eric Botcazou

volatile10.adb: New case.

	* gnat.dg/volatile10.adb: New case.
	* gnat.dg/volatile10_pkg.ads: New helper.

From-SVN: r184257
parent 0f952eb4
2012-02-15 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (call_to_gnu): Create the temporary for the
return value in the by-reference return type case if this isn't the
expression of an object declaration.  Tidy up.
2012-02-09 Tristan Gingold <gingold@adacore.com> 2012-02-09 Tristan Gingold <gingold@adacore.com>
* gcc-interface/Makefile.in: Remove .sym rule (not used). * gcc-interface/Makefile.in: Remove .sym rule (not used).
......
...@@ -3642,24 +3642,34 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, ...@@ -3642,24 +3642,34 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target,
went_into_elab_proc = true; went_into_elab_proc = true;
} }
/* First, create the temporary for the return value if we need it: for a /* First, create the temporary for the return value when:
variable-sized return type if there is no target and this is not an
object declaration, or else there is a target and it is a slice or an 1. There is no target and the function has copy-in/copy-out parameters,
array with fixed size, as the gimplifier doesn't handle these cases; because we need to preserve the return value before copying back the
otherwise for a function with copy-in/copy-out parameters if there is parameters.
no target, because we need to preserve the return value before copying
back the parameters. This must be done before we push a binding level 2. There is no target and this is not an object declaration, and the
around the call as we will pop it before copying the return value. */ return type is by-reference or has variable size, because in these
cases the gimplifier cannot create the temporary.
3. There is a target and it is a slice or an array with fixed size,
and the return type has variable size, because the gimplifier
doesn't handle these cases.
This must be done before we push a binding level around the call, since
we will pop it before copying the return value. */
if (function_call if (function_call
&& ((TREE_CODE (TYPE_SIZE (gnu_result_type)) != INTEGER_CST && ((!gnu_target && TYPE_CI_CO_LIST (gnu_subprog_type))
&& ((!gnu_target || (!gnu_target
&& Nkind (Parent (gnat_node)) != N_Object_Declaration) && Nkind (Parent (gnat_node)) != N_Object_Declaration
|| (gnu_target && (TREE_ADDRESSABLE (gnu_result_type)
&& (TREE_CODE (gnu_target) == ARRAY_RANGE_REF || TREE_CODE (TYPE_SIZE (gnu_result_type)) != INTEGER_CST))
|| (TREE_CODE (TREE_TYPE (gnu_target)) == ARRAY_TYPE || (gnu_target
&& TREE_CODE (TYPE_SIZE (TREE_TYPE (gnu_target))) && (TREE_CODE (gnu_target) == ARRAY_RANGE_REF
== INTEGER_CST))))) || (TREE_CODE (TREE_TYPE (gnu_target)) == ARRAY_TYPE
|| (!gnu_target && TYPE_CI_CO_LIST (gnu_subprog_type)))) && TREE_CODE (TYPE_SIZE (TREE_TYPE (gnu_target)))
== INTEGER_CST))
&& TREE_CODE (TYPE_SIZE (gnu_result_type)) != INTEGER_CST)))
gnu_retval = create_temporary ("R", gnu_result_type); gnu_retval = create_temporary ("R", gnu_result_type);
/* Create the list of the actual parameters as GCC expects it, namely a /* Create the list of the actual parameters as GCC expects it, namely a
......
2012-02-15 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/volatile10.adb: New case.
* gnat.dg/volatile10_pkg.ads: New helper.
2012-02-14 Jason Merrill <jason@redhat.com> 2012-02-14 Jason Merrill <jason@redhat.com>
* g++.dg/ext/attrib43.C: New. * g++.dg/ext/attrib43.C: New.
......
-- { dg-do compile }
with Volatile10_Pkg; use Volatile10_Pkg;
procedure Volatile10 is
N : Num;
begin
N := F.N1;
N := F.N2;
end;
package Volatile10_Pkg is
type Num is mod 2**9;
type Rec is record
B1 : Boolean;
N1 : Num;
B2 : Boolean;
N2 : Num;
B3 : Boolean;
B4 : Boolean;
B5 : Boolean;
B6 : Boolean;
B7 : Boolean;
B8 : Boolean;
B9 : Boolean;
B10 : Boolean;
B11 : Boolean;
B12 : Boolean;
B13 : Boolean;
B14 : Boolean;
end record;
pragma Pack (Rec);
for Rec'Size use 32;
pragma Volatile(Rec);
function F return Rec;
end Volatile10_Pkg;
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