From 616f1431bf3ad91356460164fcd7d4d8a6f3bd3f Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 19 May 2010 17:53:58 +0000 Subject: langhooks.h (struct lang_hooks): Add new field deep_unsharing. * langhooks.h (struct lang_hooks): Add new field deep_unsharing. * langhooks-def.h (LANG_HOOKS_DEEP_UNSHARING): New macro. (LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_DEEP_UNSHARING. * gimplify.c: (mostly_copy_tree_r): Copy trees under SAVE_EXPR and TARGET_EXPR nodes, but only once, if instructed to do so. Do not propagate the 'data' argument to copy_tree_r. (copy_if_shared_r): Remove bogus ATTRIBUTE_UNUSED marker. Propagate 'data' argument to walk_tree. (copy_if_shared): New function. (unmark_visited_r): Remove bogus ATTRIBUTE_UNUSED marker. (unmark_visited): New function. (unshare_body): Call copy_if_shared instead of doing it manually. (unvisit_body): Call unmark_visited instead of doing it manually. ada/ * gcc-interface/misc.c (LANG_HOOKS_DEEP_UNSHARING): Redefine. * gcc-interface/trans.c (unshare_save_expr): Delete. (gigi): Do not unshare trees under SAVE_EXPRs here. From-SVN: r159592 --- gcc/testsuite/gnat.dg/specs/controlled1.ads | 35 +++++++++++++++++++++++++ gcc/testsuite/gnat.dg/specs/controlled1_pkg.ads | 7 +++++ 2 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/specs/controlled1.ads create mode 100644 gcc/testsuite/gnat.dg/specs/controlled1_pkg.ads (limited to 'gcc/testsuite/gnat.dg/specs') diff --git a/gcc/testsuite/gnat.dg/specs/controlled1.ads b/gcc/testsuite/gnat.dg/specs/controlled1.ads new file mode 100644 index 0000000..1ceedaf --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/controlled1.ads @@ -0,0 +1,35 @@ +-- { dg-do compile } + +with Ada.Finalization; +with Controlled1_Pkg; use Controlled1_Pkg; + +package Controlled1 is + + type Collection is new Ada.Finalization.Controlled with null record; + + type Object_Kind_Type is (One, Two); + + type Byte_Array is array (Natural range <>) of Integer; + + type Bounded_Byte_Array_Type is record + A : Byte_Array (1 .. Value); + end record; + + type Object_Type is tagged record + A : Bounded_Byte_Array_Type; + end record; + + type R_Object_Type is new Object_Type with record + L : Collection; + end record; + + type Obj_Type (Kind : Object_Kind_Type := One) is record + case Kind is + when One => R : R_Object_Type; + when others => null; + end case; + end record; + + type Obj_Array_Type is array (Positive range <>) of Obj_Type; + +end Controlled1; diff --git a/gcc/testsuite/gnat.dg/specs/controlled1_pkg.ads b/gcc/testsuite/gnat.dg/specs/controlled1_pkg.ads new file mode 100644 index 0000000..3d08c1e --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/controlled1_pkg.ads @@ -0,0 +1,7 @@ +-- { dg-excess-errors "no code generated" } + +package Controlled1_Pkg is + + function Value return Natural; + +end Controlled1_Pkg; -- cgit v1.1