diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-06-03 18:14:58 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-06-03 18:14:58 +0000 |
commit | f5cb6fbff57b753288f5dc8b891877c4d0c61b29 (patch) | |
tree | 2bce0b2cc2e141e53f8e7b615c8e98314f1560ea /gcc | |
parent | 30783513f05cc8e41828a98d64aefd1e7adc9716 (diff) | |
download | gcc-f5cb6fbff57b753288f5dc8b891877c4d0c61b29.zip gcc-f5cb6fbff57b753288f5dc8b891877c4d0c61b29.tar.gz gcc-f5cb6fbff57b753288f5dc8b891877c4d0c61b29.tar.bz2 |
aliasing1.ad[sb]: New test.
* gnat.dg/aliasing1.ad[sb]: New test.
* gnat.dg/aliasing2.ad[sb]: Likewise.
From-SVN: r136331
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/aliasing1.adb | 22 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/aliasing1.ads | 13 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/aliasing2.adb | 22 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/aliasing2.ads | 10 |
5 files changed, 72 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1f319a0..28609e1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-06-03 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/aliasing1.ad[sb]: New test. + * gnat.dg/aliasing2.ad[sb]: Likewise. + 2008-06-02 Andy Hutchinson <hutchinsonandy@aim.com> * gcc.target/avr/avr.exp: Add avr testsuite. diff --git a/gcc/testsuite/gnat.dg/aliasing1.adb b/gcc/testsuite/gnat.dg/aliasing1.adb new file mode 100644 index 0000000..5d928bb --- /dev/null +++ b/gcc/testsuite/gnat.dg/aliasing1.adb @@ -0,0 +1,22 @@ +-- { dg-do compile } +-- { dg-options "-O2 -gnatp -fdump-tree-final_cleanup" } + +-- The raise statement must be optimized away by +-- virtue of DECL_NONADDRESSABLE_P set on R.I. + +package body Aliasing1 is + + function F (P : Ptr) return Integer is + begin + R.I := 0; + P.all := 1; + if R.I /= 0 then + raise Program_Error; + end if; + return 0; + end; + +end Aliasing1; + +-- { dg-final { scan-tree-dump-not "__gnat_rcheck" "final_cleanup" } } +-- { dg-final { cleanup-tree-dump "final_cleanup" } } diff --git a/gcc/testsuite/gnat.dg/aliasing1.ads b/gcc/testsuite/gnat.dg/aliasing1.ads new file mode 100644 index 0000000..9ebfd62 --- /dev/null +++ b/gcc/testsuite/gnat.dg/aliasing1.ads @@ -0,0 +1,13 @@ +package Aliasing1 is + + type Rec is record + I : Integer; + end record; + + type Ptr is access all Integer; + + R : Rec; + + function F (P : Ptr) return Integer; + +end Aliasing1; diff --git a/gcc/testsuite/gnat.dg/aliasing2.adb b/gcc/testsuite/gnat.dg/aliasing2.adb new file mode 100644 index 0000000..abfc6e1 --- /dev/null +++ b/gcc/testsuite/gnat.dg/aliasing2.adb @@ -0,0 +1,22 @@ +-- { dg-do compile } +-- { dg-options "-O2 -gnatp -fdump-tree-final_cleanup" } + +-- The raise statement must be optimized away by +-- virtue of TYPE_NONALIASED_COMPONENT set on A. + +package body Aliasing2 is + + function F (P : Ptr) return Integer is + begin + A (1) := 0; + P.all := 1; + if A(1) /= 0 then + raise Program_Error; + end if; + return 0; + end; + +end Aliasing2; + +-- { dg-final { scan-tree-dump-not "__gnat_rcheck" "final_cleanup" } } +-- { dg-final { cleanup-tree-dump "final_cleanup" } } diff --git a/gcc/testsuite/gnat.dg/aliasing2.ads b/gcc/testsuite/gnat.dg/aliasing2.ads new file mode 100644 index 0000000..7a7e411 --- /dev/null +++ b/gcc/testsuite/gnat.dg/aliasing2.ads @@ -0,0 +1,10 @@ +package Aliasing2 is + + type Arr is Array (1..4) of Integer; + type Ptr is access all Integer; + + A : Arr; + + function F (P : Ptr) return Integer; + +end Aliasing2; |