OSDN Git Service

PR fortran/27524
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 May 2006 21:18:45 +0000 (21:18 +0000)
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 May 2006 21:18:45 +0000 (21:18 +0000)
* trans-array.c (gfc_trans_dummy_array_bias): Don't use stride as
a temporary variable when -fbounds-check is enabled, since its
value will be needed later.

* gfortran.dg/bounds_check_1.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114142 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/bounds_check_1.f90 [new file with mode: 0644]

index eed3e0e..e4e2db2 100644 (file)
@@ -1,3 +1,10 @@
+2006-05-26  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+       PR fortran/27524
+       * trans-array.c (gfc_trans_dummy_array_bias): Don't use stride as
+       a temporary variable when -fbounds-check is enabled, since its
+       value will be needed later.
+
 2006-05-26  Thomas Koenig  <Thomas.Koenig@online.de>
 
        PR fortran/23151
index 32283a3..34742c3 100644 (file)
@@ -3564,7 +3564,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
   tree dumdesc;
   tree tmp;
   tree stmt;
-  tree stride;
+  tree stride, stride2;
   tree stmt_packed;
   tree stmt_unpacked;
   tree partial;
@@ -3711,9 +3711,9 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
 
              tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type,
                                 ubound, lbound);
-              stride = build2 (MINUS_EXPR, gfc_array_index_type,
+              stride2 = build2 (MINUS_EXPR, gfc_array_index_type,
                               dubound, dlbound);
-              tmp = fold_build2 (NE_EXPR, gfc_array_index_type, tmp, stride);
+              tmp = fold_build2 (NE_EXPR, gfc_array_index_type, tmp, stride2);
              gfc_trans_runtime_check (tmp, gfc_strconst_bounds, &block);
            }
        }
index e45fa3b..4910f76 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-26  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+       PR fortran/27524
+       * gfortran.dg/bounds_check_1.f90: New test.
+
 2006-05-26  Ulrich Weigand  <uweigand@de.ibm.com>
 
        PR rtl-optimization/27661
diff --git a/gcc/testsuite/gfortran.dg/bounds_check_1.f90 b/gcc/testsuite/gfortran.dg/bounds_check_1.f90
new file mode 100644 (file)
index 0000000..c05f445
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do run }
+! { dg-options "-fbounds-check" }
+! PR fortran/27524
+    integer :: res(1)
+    res = F()
+    if (res(1) /= 1) call abort
+    contains
+      function F()
+        integer :: F(1)
+        f = 1
+      end function F
+    end