diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-24 16:08:50 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-24 16:08:50 +0000 |
commit | 4524d1ceff28dd267d78bdd3e18bffd5d88db30a (patch) | |
tree | b9005d8dcb786199a152d4e3d91717ba40010452 /gcc/testsuite/gnat.dg | |
parent | 5f515621d4459b5d84f5640e0993611cbd008f3c (diff) | |
download | gcc-4524d1ceff28dd267d78bdd3e18bffd5d88db30a.tar.gz |
* einfo.ads (Size_Depends_On_Discriminant): Adjust description.
* layout.adb (Compute_Size_Depends_On_Discriminant): New procedure
to compute Set_Size_Depends_On_Discriminant.
(Layout_Type): Call it on array types in back-end layout mode.
* sem_util.adb (Requires_Transient_Scope): Return true for array
types only if the size depends on the value of discriminants.
* gcc-interface/utils2.c (build_binary_op) <MODIFY_EXPR>: Use the RHS
type if the RHS is a call to a function that returns an unconstrained
type with default discriminant.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171402 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gnat.dg')
-rw-r--r-- | gcc/testsuite/gnat.dg/array16.adb | 22 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/array16.ads | 31 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/array16_pkg.ads | 5 |
3 files changed, 58 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/array16.adb b/gcc/testsuite/gnat.dg/array16.adb new file mode 100644 index 00000000000..18abf8f8199 --- /dev/null +++ b/gcc/testsuite/gnat.dg/array16.adb @@ -0,0 +1,22 @@ +package body Array16 is + + function F1 (A : access My_T1) return My_T1 is + begin + return A.all; + end; + + function F2 (A : access My_T2) return My_T2 is + begin + return A.all; + end; + + procedure Proc (A : access My_T1; B : access My_T2) is + L1 : My_T1 := F1(A); + L2 : My_T2 := F2(B); + begin + if L1.D = 0 and then L2(1) = 0 then + raise Program_Error; + end if; + end; + +end Array16; diff --git a/gcc/testsuite/gnat.dg/array16.ads b/gcc/testsuite/gnat.dg/array16.ads new file mode 100644 index 00000000000..69452c98f3a --- /dev/null +++ b/gcc/testsuite/gnat.dg/array16.ads @@ -0,0 +1,31 @@ +-- { dg-do compile } +-- { dg-options "-O -gnatn -fdump-tree-optimized" } + +with Array16_Pkg; + +package Array16 is + + type T1 (D : Integer) is record + case D is + when 1 => I : Integer; + when others => null; + end case; + end record; + + type Arr is array (Integer range <>) of Integer; + + type My_T1 is new T1 (Array16_Pkg.N); + type My_T2 is new Arr (1 .. Integer'Min (2, Array16_Pkg.N)); + + function F1 (A : access My_T1) return My_T1; + pragma Inline (F1); + + function F2 (A : access My_T2) return My_T2; + pragma Inline (F2); + + procedure Proc (A : access My_T1; B : access My_T2); + +end Array16; + +-- { dg-final { scan-tree-dump-not "secondary_stack" "optimized" } } +-- { dg-final { cleanup-tree-dump "optimized" } } diff --git a/gcc/testsuite/gnat.dg/array16_pkg.ads b/gcc/testsuite/gnat.dg/array16_pkg.ads new file mode 100644 index 00000000000..93447978cd4 --- /dev/null +++ b/gcc/testsuite/gnat.dg/array16_pkg.ads @@ -0,0 +1,5 @@ +package Array16_Pkg is + + function N return Integer; + +end Array16_Pkg; |