Commit bb29e9ff by Eric Botcazou Committed by Eric Botcazou

trans.c (Call_to_gnu): Deal with specific conditional expressions for misaligned actual parameters.

	* gcc-interface/trans.c (Call_to_gnu): Deal with specific conditional
	expressions for misaligned actual parameters.

From-SVN: r201700
parent 761a8eb7
2013-08-13 Eric Botcazou <ebotcazou@adacore.com> 2013-08-13 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (Call_to_gnu): Deal with specific conditional
expressions for misaligned actual parameters.
2013-08-13 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (can_equal_min_or_max_val_p): Be prepared for * gcc-interface/trans.c (can_equal_min_or_max_val_p): Be prepared for
values outside of the range of the type. values outside of the range of the type.
......
...@@ -4022,9 +4022,19 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, ...@@ -4022,9 +4022,19 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target,
/* Set up to move the copy back to the original if needed. */ /* Set up to move the copy back to the original if needed. */
if (!in_param) if (!in_param)
{ {
gnu_stmt = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_orig, /* If the original is a COND_EXPR whose first arm isn't meant to
gnu_temp); be further used, just deal with the second arm. This is very
likely the conditional expression built for a check. */
if (TREE_CODE (gnu_orig) == COND_EXPR
&& TREE_CODE (TREE_OPERAND (gnu_orig, 1)) == COMPOUND_EXPR
&& integer_zerop
(TREE_OPERAND (TREE_OPERAND (gnu_orig, 1), 1)))
gnu_orig = TREE_OPERAND (gnu_orig, 2);
gnu_stmt
= build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_orig, gnu_temp);
set_expr_location_from_node (gnu_stmt, gnat_node); set_expr_location_from_node (gnu_stmt, gnat_node);
append_to_statement_list (gnu_stmt, &gnu_after_list); append_to_statement_list (gnu_stmt, &gnu_after_list);
} }
} }
......
2013-08-13 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/valued_proc.adb: New test.
* gnat.dg/valued_proc_pkg.ads: New helper.
2013-08-13 Jakub Jelinek <jakub@redhat.com> 2013-08-13 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/57661 PR tree-optimization/57661
......
-- { dg-do compile }
-- { dg-options "-gnatdm -gnatws" }
with Valued_Proc_Pkg; use Valued_Proc_Pkg;
with System; use System;
procedure Valued_Proc is
Status : UNSIGNED_LONGWORD;
Length : POSITIVE;
begin
GetMsg (Status, UNSIGNED_WORD(Length));
end;
pragma Extend_System (Aux_DEC);
with System; use System;
package Valued_Proc_Pkg is
procedure GETMSG (STATUS : out UNSIGNED_LONGWORD;
MSGLEN : out UNSIGNED_WORD);
pragma Interface (EXTERNAL, GETMSG);
pragma IMPORT_VALUED_PROCEDURE (GETMSG, "SYS$GETMSG",
(UNSIGNED_LONGWORD, UNSIGNED_WORD),
(VALUE, REFERENCE));
end Valued_Proc_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