This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [FORTRAN mainline] dereference POINTER_PLUS_EXPR check (was tuples)
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: Richard Guenther <richard dot guenther at gmail dot com>, fortran at gcc dot gnu dot org
- Cc: Andrew Pinski <pinskia at gmail dot com>, Diego Novillo <dnovillo at google dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 22 Nov 2007 20:27:27 -0400
- Subject: Re: [FORTRAN mainline] dereference POINTER_PLUS_EXPR check (was tuples)
- References: <20071121204635.GA7204@redhat.com> <4744A197.1060701@google.com> <20071121215235.GA11077@redhat.com> <84fc9c000711211357w7a2587d2n663dd561845e4e1c@mail.gmail.com> <20071121225800.GA5508@redhat.com> <84fc9c000711211525h37554477yf567a8265f09d59@mail.gmail.com> <20071122005837.GA7171@redhat.com> <de8d50360711211709k61f0f066lf483e97645564df2@mail.gmail.com> <20071122172301.GA17740@redhat.com> <84fc9c000711220948p74bf7bb8he63f95baf9ba38f1@mail.gmail.com>
> It should use the type of DEST, all pointers are trivially convertible
> to void *,
> which is the formal argument of memset (in the ChangeLog you have memmove).
>
> Not that it makes a big difference here (in the end we try to be type-exact in
> one expression tree, but as the expression result type will vanish with tuples,
> there won't a difference for both cases).
Fixed below.
> I wonder if the problem you see has been fixed with the fix for PR31608 which
> went in a few days ago?
No. Latest mainline still exhibited the same problem. The P_P_E was
still wrong.
I know Tobias approved the patch, but let me know if this updated one
using the type of [dest] is what you wanted.
No regressions on fortran tests.
Aldy
* trans-expr.c (gfc_trans_string_copy): Use "void *" when building a
memset.
--- trans-expr.c (revision 130355)
+++ trans-expr.c (local)
@@ -2701,7 +2701,7 @@ gfc_trans_string_copy (stmtblock_t * blo
tmp3 = build_call_expr (built_in_decls[BUILT_IN_MEMMOVE],
3, dest, src, slen);
- tmp4 = fold_build2 (POINTER_PLUS_EXPR, pchar_type_node, dest,
+ tmp4 = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (dest), dest,
fold_convert (sizetype, slen));
tmp4 = build_call_expr (built_in_decls[BUILT_IN_MEMSET], 3,
tmp4,