This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Regressions caused by copy_string patch.
Steve Kargl wrote:
On Thu, Jul 13, 2006 at 10:16:54PM -0700, Steve Kargl wrote:
On Thu, Jul 13, 2006 at 10:10:07PM -0700, Jerry DeLisle wrote:
Jack Howarth wrote:
Steve,
If that is the offending patch then I'm not surprised that I'm
not seeing the problem as I tested that patch a couple weeks back
and it worked fine on MacOS X (at least ppc). It would be interesting
to know if Macintel shows any breakage.
Jack
Just did a bootstrap on latest trunk. No regressions on i686.
It could be target specific and/or a 64-bit problem.
I just determined a method for removing only FX's
patch. I know soon if its the problem.
It is definitely caused by the copy_string patch.
I'll be away for the week-end. If you can test the attached patch, I
think it ought to fix it (the len argument of memmove and memset really
ought to be a size_t). Otherwise, you're welcome to revert the patch
before I come back on Monday and can test it (I've received a
x86_64-linux cluster a few days ago).
FX
Index: trans-expr.c
===================================================================
--- trans-expr.c (revision 115372)
+++ trans-expr.c (working copy)
@@ -2280,13 +2280,13 @@
cond2 = fold_build2 (GE_EXPR, boolean_type_node, slen, dlen);
tmp2 = gfc_chainon_list (NULL_TREE, dest);
tmp2 = gfc_chainon_list (tmp2, src);
- tmp2 = gfc_chainon_list (tmp2, dlen);
+ tmp2 = gfc_chainon_list (tmp2, fold_convert (size_type_node, dlen));
tmp2 = build_function_call_expr (built_in_decls[BUILT_IN_MEMMOVE], tmp2);
/* Else copy and pad with spaces. */
tmp3 = gfc_chainon_list (NULL_TREE, dest);
tmp3 = gfc_chainon_list (tmp3, src);
- tmp3 = gfc_chainon_list (tmp3, slen);
+ tmp3 = gfc_chainon_list (tmp3, fold_convert (size_type_node, slen));
tmp3 = build_function_call_expr (built_in_decls[BUILT_IN_MEMMOVE], tmp3);
tmp4 = fold_build2 (PLUS_EXPR, pchar_type_node, dest,
@@ -2295,8 +2295,10 @@
tmp4 = gfc_chainon_list (tmp4, build_int_cst
(gfc_get_int_type (gfc_c_int_kind),
lang_hooks.to_target_charset (' ')));
- tmp4 = gfc_chainon_list (tmp4, fold_build2 (MINUS_EXPR, TREE_TYPE(dlen),
- dlen, slen));
+ tmp4 = gfc_chainon_list (tmp4, fold_convert (size_type_node,
+ fold_build2 (MINUS_EXPR,
+ TREE_TYPE(dlen),
+ dlen, slen)));
tmp4 = build_function_call_expr (built_in_decls[BUILT_IN_MEMSET], tmp4);
gfc_init_block (&tempblock);