diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-04-07 09:47:43 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-04-07 09:47:43 +0000 |
commit | 39fcde8ff2ba378999f0466b8d65c233042c51b6 (patch) | |
tree | 5f52e504245f353cbf4c7ab73aff6c9c36257959 /gcc/testsuite | |
parent | 9dd9bf80a87fdd119261f5efb8a9ceceffb12963 (diff) | |
download | gcc-39fcde8ff2ba378999f0466b8d65c233042c51b6.zip gcc-39fcde8ff2ba378999f0466b8d65c233042c51b6.tar.gz gcc-39fcde8ff2ba378999f0466b8d65c233042c51b6.tar.bz2 |
fold-const.c (fold): New case.
* fold-const.c (fold) <ARRAY_REF>: New case. Try to fold constant
reference in constructor with non self-referential type.
ada/
* utils2.c (build_binary_op): Fold ARRAY_REF and ARRAY_RANGE_REF too.
From-SVN: r133977
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/array4.adb | 37 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/specs/static_initializer2.ads | 22 |
3 files changed, 64 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index beac0eb..d4e38e8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-04-07 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/array4.adb: New test. + * gnat.dg/specs/static_initializer2.ads: Likewise. + 2008-04-06 Richard Guenther <rguenther@suse.de> PR tree-optimization/35400 diff --git a/gcc/testsuite/gnat.dg/array4.adb b/gcc/testsuite/gnat.dg/array4.adb new file mode 100644 index 0000000..048698a --- /dev/null +++ b/gcc/testsuite/gnat.dg/array4.adb @@ -0,0 +1,37 @@ +-- { dg-do run } + +procedure Array4 is + + type A is array (1..5) of Integer; + f : constant A := (1, 2, 3, 4, 5); + + i1 : integer renames f(1); + i2 : integer renames f(2); + i3 : integer renames f(3); + i4 : integer renames f(4); + i5 : integer renames f(5); + + procedure Link_Failure; + pragma Import (C, Link_Failure); + +begin + if i1 /= 1 then + Link_Failure; + end if; + + if i2 /= 2 then + Link_Failure; + end if; + + if i3 /= 3 then + Link_Failure; + end if; + + if i4 /= 4 then + Link_Failure; + end if; + + if i5 /= 5 then + Link_Failure; + end if; +end; diff --git a/gcc/testsuite/gnat.dg/specs/static_initializer2.ads b/gcc/testsuite/gnat.dg/specs/static_initializer2.ads new file mode 100644 index 0000000..3b27f26 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/static_initializer2.ads @@ -0,0 +1,22 @@ +-- { dg-do compile } + +package Static_Initializer2 is + + type A is array (1..5) of Integer; + f : constant A := (1, 2, 3, 4, 5); + + i1 : integer renames f(1); + i2 : integer renames f(2); + i3 : integer renames f(3); + i4 : integer renames f(4); + i5 : integer renames f(5); + + b1 : boolean := i1 = 1; + b2 : boolean := i2 = 2; + b3 : boolean := i3 = 3; + b4 : boolean := i4 = 4; + b5 : boolean := i5 = 5; + +end Static_Initializer2; + +-- { dg-final { scan-assembler-not "elabs" } } |