OSDN Git Service

2006-12-20 Paul Thomas <pault@gcc.gnu.org>
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Dec 2006 21:10:51 +0000 (21:10 +0000)
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Dec 2006 21:10:51 +0000 (21:10 +0000)
PR fortran/30190
* trans-array.c (gfc_conv_array_ref): Remove gfc_evaluate_now
from the -fbounds-check branch.

2006-12-20  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/30190
* gfortran.dg/bounds_check_5.f90: New test.

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

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

index 0eb5dc5..c3b60fc 100644 (file)
@@ -1,3 +1,9 @@
+2006-12-20  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/30190
+       * trans-array.c (gfc_conv_array_ref): Remove gfc_evaluate_now
+       from the -fbounds-check branch.
+
 2006-12-20  Roger Sayle  <roger@eyesopen.com>
 
        * trans-expr.c (is_zero_initializer_p): Determine whether a given
index 0858988..6201c4c 100644 (file)
@@ -2094,8 +2094,6 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym,
          tree cond;
          char *msg;
 
-         indexse.expr = gfc_evaluate_now (indexse.expr, &se->pre);
-
          tmp = gfc_conv_array_lbound (se->expr, n);
          cond = fold_build2 (LT_EXPR, boolean_type_node, 
                              indexse.expr, tmp);
index dac041b..4d43f79 100644 (file)
@@ -1,3 +1,8 @@
+2006-12-20  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/30190
+       * gfortran.dg/bounds_check_5.f90: New test.
+
 2006-12-20  Andrew Pinski  <pinskia@gmail.com>
 
        PR middle-end/30143
diff --git a/gcc/testsuite/gfortran.dg/bounds_check_5.f90 b/gcc/testsuite/gfortran.dg/bounds_check_5.f90
new file mode 100644 (file)
index 0000000..3a2fc63
--- /dev/null
@@ -0,0 +1,17 @@
+! { dg-do run }
+! This tests the fix for PR30190, in which the array reference
+! in the associated statement would cause a segfault.
+!
+! Contributed by Tobias Burnus  <burnus@gcc.gnu.org>
+!
+  TYPE particle_type
+     INTEGER, POINTER :: p(:)
+  END TYPE particle_type
+  TYPE(particle_type), POINTER  :: t(:)
+  integer :: i
+  logical :: f
+  i = 1
+  allocate(t(1))
+  allocate(t(1)%p(0))
+  f = associated(t(i)%p,t(i)%p)
+end