aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch6.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-10-26 13:03:29 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2015-10-26 13:03:29 +0100
commit638f50548143c46e32bca3b9e38bfc8e9251672b (patch)
tree4a8b54474e773e468dd4769af6852f425578bf66 /gcc/ada/exp_ch6.adb
parentb30fc1f9d6ca2ad28b3c136e88049a285533df8f (diff)
downloadgcc-638f50548143c46e32bca3b9e38bfc8e9251672b.zip
gcc-638f50548143c46e32bca3b9e38bfc8e9251672b.tar.gz
gcc-638f50548143c46e32bca3b9e38bfc8e9251672b.tar.bz2
[multiple changes]
2015-10-26 Javier Miranda <miranda@adacore.com> * exp_ch6.adb (Expand_N_Subprogram_Declaration): Skip the frontend transformation of functions that return a constrained array into a procedure when they are unchecked_conversion instances. 2015-10-26 Gary Dismukes <dismukes@adacore.com> * s-os_lib.ads: Minor reformatting/rewording. From-SVN: r229350
Diffstat (limited to 'gcc/ada/exp_ch6.adb')
-rw-r--r--gcc/ada/exp_ch6.adb5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index a666ab2..b848858 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -5666,10 +5666,15 @@ package body Exp_Ch6 is
-- constrained array type into a procedure with an out parameter
-- that carries the return value.
+ -- We skip this transformation for unchecked conversions, since they
+ -- are not needed by the C generator (and this also produces cleaner
+ -- output).
+
if Modify_Tree_For_C
and then Nkind (Specification (N)) = N_Function_Specification
and then Is_Array_Type (Etype (Subp))
and then Is_Constrained (Etype (Subp))
+ and then not Is_Unchecked_Conversion_Instance (Subp)
then
Build_Procedure_Form;
end if;