diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-08-01 12:39:57 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-08-01 12:39:57 +0000 |
commit | 8df2e9022925c06ab369d74a301bcf081ddc417e (patch) | |
tree | f4efd12be81b0704af9d6a64d314a9b55e716b01 /gcc/testsuite/gnat.dg | |
parent | 5c3554b7ad2c8041a923228037141f83c9e70fc6 (diff) | |
download | gcc-8df2e9022925c06ab369d74a301bcf081ddc417e.zip gcc-8df2e9022925c06ab369d74a301bcf081ddc417e.tar.gz gcc-8df2e9022925c06ab369d74a301bcf081ddc417e.tar.bz2 |
decl.c (gnat_to_gnu_entity): Remove dead code.
2008-08-01 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: Remove dead
code. Do not get full definition of deferred constants with address
clause for a use. Do not ignore deferred constant definitions with
address clause. Ignore constant definitions already marked with the
error node.
<object>: Remove obsolete comment. For a deferred constant with
address clause, get the initializer from the full view.
* gcc-interface/trans.c (gnat_to_gnu) <N_Attribute_Definition_Clause>:
Rework and remove obsolete comment.
<N_Object_Declaration>: For a deferred constant with address clause,
mark the full view with the error node.
* gcc-interface/utils.c (convert_to_fat_pointer): Rework and fix
formatting nits.
From-SVN: r138513
Diffstat (limited to 'gcc/testsuite/gnat.dg')
-rw-r--r-- | gcc/testsuite/gnat.dg/deferred_const1.adb | 12 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/deferred_const2.adb | 11 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/deferred_const2_pkg.adb | 11 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/deferred_const2_pkg.ads | 12 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/deferred_const3.adb | 19 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/deferred_const3_pkg.adb | 19 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/deferred_const3_pkg.ads | 21 |
7 files changed, 105 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/deferred_const1.adb b/gcc/testsuite/gnat.dg/deferred_const1.adb new file mode 100644 index 0000000..79b9f4a --- /dev/null +++ b/gcc/testsuite/gnat.dg/deferred_const1.adb @@ -0,0 +1,12 @@ +-- { dg-do compile } + +with Text_IO; use Text_IO; + +procedure Deferred_Const1 is + I : Integer := 16#20_3A_2D_28#; + S : constant string(1..4); + for S'address use I'address; -- { dg-warning "constant overlays a variable" } + pragma Import (Ada, S); +begin + Put_Line (S); +end; diff --git a/gcc/testsuite/gnat.dg/deferred_const2.adb b/gcc/testsuite/gnat.dg/deferred_const2.adb new file mode 100644 index 0000000..ee06db7 --- /dev/null +++ b/gcc/testsuite/gnat.dg/deferred_const2.adb @@ -0,0 +1,11 @@ +-- { dg-do run } + +with System; use System; +with Deferred_Const2_Pkg; use Deferred_Const2_Pkg; + +procedure Deferred_Const2 is +begin + if I'Address /= S'Address then + raise Program_Error; + end if; +end; diff --git a/gcc/testsuite/gnat.dg/deferred_const2_pkg.adb b/gcc/testsuite/gnat.dg/deferred_const2_pkg.adb new file mode 100644 index 0000000..b81d448 --- /dev/null +++ b/gcc/testsuite/gnat.dg/deferred_const2_pkg.adb @@ -0,0 +1,11 @@ +with System; use System; + +package body Deferred_Const2_Pkg is + + procedure Dummy is begin null; end; + +begin + if S'Address /= I'Address then + raise Program_Error; + end if; +end Deferred_Const2_Pkg; diff --git a/gcc/testsuite/gnat.dg/deferred_const2_pkg.ads b/gcc/testsuite/gnat.dg/deferred_const2_pkg.ads new file mode 100644 index 0000000..c76e5fd --- /dev/null +++ b/gcc/testsuite/gnat.dg/deferred_const2_pkg.ads @@ -0,0 +1,12 @@ +package Deferred_Const2_Pkg is + + I : Integer := 16#20_3A_2D_28#; + + pragma Warnings (Off); + S : constant string(1..4); + for S'address use I'address; + pragma Import (Ada, S); + + procedure Dummy; + +end Deferred_Const2_Pkg; diff --git a/gcc/testsuite/gnat.dg/deferred_const3.adb b/gcc/testsuite/gnat.dg/deferred_const3.adb new file mode 100644 index 0000000..84554d3 --- /dev/null +++ b/gcc/testsuite/gnat.dg/deferred_const3.adb @@ -0,0 +1,19 @@ +-- { dg-do run } + +with System; use System; +with Deferred_Const3_Pkg; use Deferred_Const3_Pkg; + +procedure Deferred_Const3 is +begin + if C1'Address /= C'Address then + raise Program_Error; + end if; + + if C2'Address /= C'Address then + raise Program_Error; + end if; + + if C3'Address /= C'Address then + raise Program_Error; + end if; +end; diff --git a/gcc/testsuite/gnat.dg/deferred_const3_pkg.adb b/gcc/testsuite/gnat.dg/deferred_const3_pkg.adb new file mode 100644 index 0000000..e865494 --- /dev/null +++ b/gcc/testsuite/gnat.dg/deferred_const3_pkg.adb @@ -0,0 +1,19 @@ +with System; use System; + +package body Deferred_Const3_Pkg is + + procedure Dummy is begin null; end; + +begin + if C1'Address /= C'Address then + raise Program_Error; + end if; + + if C2'Address /= C'Address then + raise Program_Error; + end if; + + if C3'Address /= C'Address then + raise Program_Error; + end if; +end Deferred_Const3_Pkg; diff --git a/gcc/testsuite/gnat.dg/deferred_const3_pkg.ads b/gcc/testsuite/gnat.dg/deferred_const3_pkg.ads new file mode 100644 index 0000000..de6af3d --- /dev/null +++ b/gcc/testsuite/gnat.dg/deferred_const3_pkg.ads @@ -0,0 +1,21 @@ +package Deferred_Const3_Pkg is + + C : constant Natural := 1; + + C1 : constant Natural := 1; + for C1'Address use C'Address; + + C2 : constant Natural; + for C2'Address use C'Address; + + C3 : constant Natural; + + procedure Dummy; + +private + C2 : constant Natural := 1; + + C3 : constant Natural := 1; + for C3'Address use C'Address; + +end Deferred_Const3_Pkg; |