[gfortran,patch] Fix wrong-code for ASSOCIATED
FX Coudert
fxcoudert@gmail.com
Sun Jun 18 17:17:00 GMT 2006
> I noticed that in the ELSE portion of outer ithe IF statement, there
> is an "if (ss1 == gfc_ss_terminator)" block (see line 2858). Do
> we need to insert the same two lines above the "tmp = " (line 2866)?
Right you are. Applying the same fix (see patch at the end of the mail)
allows the following testcase to work:
integer :: i
integer,target :: u
logical :: l
type dt
integer, pointer :: a => NULL()
end type dt
type(dt) :: obj(1)
i = 2
l = associated(obj(i)%a)
print *, l
l = associated(obj(i)%a,u)
print *, l
end
I intend to commit the whole patch in 24 hours, unless someone objects.
FX
PS: The complete patch is
Index: trans-intrinsic.c
===================================================================
--- trans-intrinsic.c (revision 114721)
+++ trans-intrinsic.c (working copy)
@@ -2840,6 +2840,8 @@
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_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;
}
More information about the Gcc-patches
mailing list