re PR fortran/26801 (-fbounds-check generates segfault)

PR fortran/26801

	* trans-intrinsic.c (gfc_conv_associated): Use pre and post blocks
	of the scalarization expression.

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

From-SVN: r114757
This commit is contained in:
Francois-Xavier Coudert 2006-06-18 19:36:47 +02:00 committed by François-Xavier Coudert
parent a9c4699889
commit 98efaf34b2
4 changed files with 35 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2006-06-18 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/26801
* trans-intrinsic.c (gfc_conv_associated): Use pre and post blocks
of the scalarization expression.
2006-06-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/19310

View File

@ -2840,6 +2840,8 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
gfc_conv_expr_lhs (&arg1se, arg1->expr);
tmp2 = gfc_conv_descriptor_data_get (arg1se.expr);
}
gfc_add_block_to_block (&se->pre, &arg1se.pre);
gfc_add_block_to_block (&se->post, &arg1se.post);
tmp = build2 (NE_EXPR, boolean_type_node, tmp2,
fold_convert (TREE_TYPE (tmp2), null_pointer_node));
se->expr = tmp;
@ -2863,6 +2865,8 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
gfc_conv_expr (&arg1se, arg1->expr);
arg2se.want_pointer = 1;
gfc_conv_expr (&arg2se, arg2->expr);
gfc_add_block_to_block (&se->pre, &arg1se.pre);
gfc_add_block_to_block (&se->post, &arg1se.post);
tmp = build2 (EQ_EXPR, boolean_type_node, arg1se.expr, arg2se.expr);
se->expr = tmp;
}

View File

@ -1,3 +1,8 @@
2006-06-18 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/26801
* gfortran.dg/associated_4.f90: New test.
2006-06-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/19310

View File

@ -0,0 +1,20 @@
! { dg-do run }
! PR fortran/26801
implicit none
integer :: i
integer,target :: u
logical :: l
character(len=8) :: A
type dt
integer, pointer :: a => NULL()
end type dt
type(dt) :: obj(2)
i = 2
l = associated(obj(i)%a)
write(A,*) l
l = associated(obj(i)%a,u)
print *, l
write(A,*) l
end