re PR fortran/13792 (lbound/ubound generates internal compiler error)
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
Thu, 15 Jul 2004 19:55:05 +0000 (21:55 +0200)
committerTobias Schlüter <tobi@gcc.gnu.org>
Thu, 15 Jul 2004 19:55:05 +0000 (21:55 +0200)
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.

From-SVN: r84773

gcc/fortran/ChangeLog
gcc/fortran/simplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/execute/bounds.f90

index e69b5de1e205b9720fd561601c83c244bc9d04d8..fd67582631b6f36189117d153135ba3f66960c5a 100644 (file)
@@ -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
index a90d05d04608a4afd7a1344f989319c25c67660c..d67b5c68ace4b11c63ec0ed7f7a4cac404572449 100644 (file)
@@ -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]);
 }
 
 
index ccda3e5333272435d43c2c3b48d431a6ac4a0973..8626dbb85eabc6489a1c63b82dcfaace21fdedd7 100644 (file)
@@ -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.
index b1ad840738c12529c9cf0091d11495b3fefca44c..894cd5d56b26fe32413091443d9b57a41b2fdd3d 100644 (file)
@@ -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