diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-04-17 10:22:40 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-04-17 10:22:40 +0000 |
commit | 07c8ac82d2ec686ba093794646c23e765df95ad8 (patch) | |
tree | 5ab97c5d9cfe522c640e3afb90d15f8809fb181e /gcc | |
parent | d1fdaace175be40dba846aba1238b9ed4084259a (diff) | |
download | gcc-07c8ac82d2ec686ba093794646c23e765df95ad8.tar.gz |
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Function>: Declare the
padded type built for the return type if it is unconstrained.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172608 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/discr27.adb | 2 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/discr27.ads | 2 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/discr28.adb | 25 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/discr28.ads | 19 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/discr28_pkg.ads | 5 |
8 files changed, 69 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3e8595940d7..8f52d5a50b1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2011-04-17 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Function>: Declare the + padded type built for the return type if it is unconstrained. + 2011-04-14 Nathan Froyd <froydnj@codesourcery.com> * gcc-interface/utils.c (gnat_poplevel): Use block_chainon. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index bc6b9cc7bf3..185df85af32 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -4068,6 +4068,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) max_size (TYPE_SIZE (gnu_return_type), true), 0, gnat_entity, false, false, false, true); + + /* Declare it now since it will never be declared otherwise. + This is necessary to ensure that its subtrees are properly + marked. */ + create_type_decl (TYPE_NAME (gnu_return_type), gnu_return_type, + NULL, true, debug_info_p, gnat_entity); + return_by_invisi_ref_p = true; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ac7833b5953..8e258482f18 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-04-17 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/discr27.ad[sb]: Move dg directive. + * gnat.dg/discr28.ad[sb]: New test. + * gnat.dg/discr28_pkg.ads: New helper. + 2011-04-17 Michael Matz <matz@suse.de> PR tree-optimization/48622 diff --git a/gcc/testsuite/gnat.dg/discr27.adb b/gcc/testsuite/gnat.dg/discr27.adb index cfaba34c2f9..875fe435b66 100644 --- a/gcc/testsuite/gnat.dg/discr27.adb +++ b/gcc/testsuite/gnat.dg/discr27.adb @@ -1,3 +1,5 @@ +-- { dg-do compile }
+
package body Discr27 is
subtype Index is Positive range 1..4096;
diff --git a/gcc/testsuite/gnat.dg/discr27.ads b/gcc/testsuite/gnat.dg/discr27.ads index db1914accc3..247134a9916 100644 --- a/gcc/testsuite/gnat.dg/discr27.ads +++ b/gcc/testsuite/gnat.dg/discr27.ads @@ -1,5 +1,3 @@ --- { dg-do compile }
-
package Discr27 is
procedure Proc;
diff --git a/gcc/testsuite/gnat.dg/discr28.adb b/gcc/testsuite/gnat.dg/discr28.adb new file mode 100644 index 00000000000..97ca8cd68b7 --- /dev/null +++ b/gcc/testsuite/gnat.dg/discr28.adb @@ -0,0 +1,25 @@ +-- { dg-do compile } + +package body Discr28 is + + procedure Dummy (E : Rec) is + begin + null; + end; + + function F return Rec is + begin + return Default_Rec; + end; + + procedure Proc1 is + begin + Dummy (F); + end; + + procedure Proc2 is + begin + Dummy (F); + end; + +end Discr28; diff --git a/gcc/testsuite/gnat.dg/discr28.ads b/gcc/testsuite/gnat.dg/discr28.ads new file mode 100644 index 00000000000..3288b52bfcb --- /dev/null +++ b/gcc/testsuite/gnat.dg/discr28.ads @@ -0,0 +1,19 @@ +with Discr28_Pkg; + +package Discr28 is + + type Enum is (One, Two); + + type Rec (D : Enum := One) is record + case D is + when One => null; + when Two => S : String (1 .. Discr28_Pkg.N); + end case; + end record; + + Default_Rec : constant Rec := (D => One); + + procedure Proc1; + procedure Proc2; + +end Discr28; diff --git a/gcc/testsuite/gnat.dg/discr28_pkg.ads b/gcc/testsuite/gnat.dg/discr28_pkg.ads new file mode 100644 index 00000000000..f6be834eedc --- /dev/null +++ b/gcc/testsuite/gnat.dg/discr28_pkg.ads @@ -0,0 +1,5 @@ +package Discr28_Pkg is + + function N return Natural; + +end Discr28_Pkg; |