aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2006-10-14 13:09:56 +0000
committerPaul Thomas <pault@gcc.gnu.org>2006-10-14 13:09:56 +0000
commit467f18f389215fd82103477340905ea8b9638d07 (patch)
treefc9e29dc712499b64f694f8ea4a15e438a55d569
parent621048c8f5830e0b7a5c4b936543aeb56b0f623a (diff)
downloadgcc-467f18f389215fd82103477340905ea8b9638d07.zip
gcc-467f18f389215fd82103477340905ea8b9638d07.tar.gz
gcc-467f18f389215fd82103477340905ea8b9638d07.tar.bz2
re PR fortran/29371 (Coredump when using -fbounds-check with pointer & nullify)
2006-10-14 Paul Thomas <pault@gcc.gnu.org> PR fortran/29371 * trans-expr.c (gfc_trans_pointer_assignment): Add the expression for the assignment of null to the data field to se->pre, rather than block. 2006-10-14 Paul Thomas <pault@gcc.gnu.org> PR fortran/29371 * gfortran.dg/nullify_3.f90: New test. From-SVN: r117732
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/trans-expr.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/nullify_3.f9026
4 files changed, 39 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index c487767..910de0d 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2006-10-14 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/29371
+ * trans-expr.c (gfc_trans_pointer_assignment): Add the expression
+ for the assignment of null to the data field to se->pre, rather
+ than block.
+
2006-10-14 Kazu Hirata <kazu@codesourcery.com>
* intrinsic.texi: Fix typos.
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 875092f..190a115 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -3149,7 +3149,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2)
{
case EXPR_NULL:
/* Just set the data pointer to null. */
- gfc_conv_descriptor_data_set (&block, lse.expr, null_pointer_node);
+ gfc_conv_descriptor_data_set (&lse.pre, lse.expr, null_pointer_node);
break;
case EXPR_VARIABLE:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index dbdd789..075f175 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-10-14 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/29371
+ * gfortran.dg/nullify_3.f90: New test.
+
2006-10-14 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/pthread-init-2.c (dg-options): Define _POSIX_C_SOURCE=199506L
diff --git a/gcc/testsuite/gfortran.dg/nullify_3.f90 b/gcc/testsuite/gfortran.dg/nullify_3.f90
new file mode 100644
index 0000000..7d202a2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/nullify_3.f90
@@ -0,0 +1,26 @@
+! { dg-do run }
+! { dg-options "-O0 -fbounds-check" }
+! Tests patch for PR29371, in which the null pointer
+! assignment would cause a segfault with the bounds
+! check on.
+!
+! Contributed by Tobias Burnus <tobias.burnus@physik.fu-berlin.de>
+!
+program test
+ implicit none
+ type projector_t
+ real, pointer :: ket(:, :), bra(:, :)
+ end type projector_t
+
+ type(projector_t),pointer, dimension(:) :: p
+ integer :: stat,i
+ allocate(p(2),stat=stat)
+ do i = 1, 2
+ nullify(p(i)%bra)
+ nullify(p(i)%ket)
+ end do
+ do i = 1, 2
+ if (associated (p(i)%bra)) call abort ()
+ if (associated (p(i)%ket)) call abort ()
+ end do
+end program