summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-15 19:55:05 +0000
committertobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-15 19:55:05 +0000
commiteca4df545439699956a77f4638c59943e35a17b4 (patch)
tree3b66f741646de966e13644d5b4bea988310353c1
parente9661e6e5b1603d266e571e12bfa188d18e7e964 (diff)
downloadgcc-eca4df545439699956a77f4638c59943e35a17b4.tar.gz
fortran/
PR fortran/13792 * simplify.c (gfc_simplify_bound): Copy the bound expression. testsuite/ PR fortran/13792 * gfortran.fortran-torture/execute/bounds.f90: Add check for compile-time simplification. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84773 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/simplify.c4
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/execute/bounds.f903
4 files changed, 13 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index e69b5de1e20..fd67582631b 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -6,7 +6,10 @@
PR fortran/15140
* trans-decl.c (gfc_trans_deferred_vars): Remove bogus assertion.
-
+
+ PR fortran/13792
+ * simplify.c (gfc_simplify_bound): Copy the bound expression.
+
2004-07-15 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/15324
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index a90d05d0460..d67b5c68ace 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -1892,9 +1892,9 @@ gfc_simplify_bound (gfc_expr * array, gfc_expr * dim, int upper)
i = mpz_get_si (dim->value.integer);
if (upper)
- return as->upper[i-1];
+ return gfc_copy_expr (as->upper[i-1]);
else
- return as->lower[i-1];
+ return gfc_copy_expr (as->lower[i-1]);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ccda3e53332..8626dbb85ea 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -9,6 +9,10 @@
PR fortran/15140
* gfortran.dg/pr15140.f90: New test.
+ PR fortran/13792
+ * gfortran.fortran-torture/execute/bounds.f90: Add check for
+ compile-time simplification.
+
2004-07-14 Mike Stump <mrs@apple.com>
* gcc.dg/20020426-2.c: Improve type safety wrt unsignedness.
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/bounds.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/bounds.f90
index b1ad840738c..894cd5d56b2 100644
--- a/gcc/testsuite/gfortran.fortran-torture/execute/bounds.f90
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/bounds.f90
@@ -5,6 +5,9 @@ program testbounds
integer, dimension(5) :: j
integer i
+ ! Check compile time simplification
+ if (lbound(j,1).ne.1 .or. ubound(j,1).ne.5) call abort ()
+
allocate (a(3:8, 6:7))
! With one parameter