This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/41714] [OOP] ALLOCATE SOURCE= does not properly copy the value from SOURCE
- From: "janus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Oct 2009 10:24:09 -0000
- Subject: [Bug fortran/41714] [OOP] ALLOCATE SOURCE= does not properly copy the value from SOURCE
- References: <bug-41714-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from janus at gcc dot gnu dot org 2009-10-25 10:24 -------
(In reply to comment #4)
> internal compiler error: in tree_annotate_all_with_location, at gimplify.c:892
This goes away with the following patchlet:
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (Revision 153538)
+++ gcc/fortran/trans-expr.c (Arbeitskopie)
@@ -4888,7 +4888,10 @@ gfc_build_memcpy_call (tree dst, tree src, tree le
/* Construct call to __builtin_memcpy. */
tmp = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMCPY], 3, dst, src, len);
- return fold_convert (void_type_node, tmp);
+ if (TREE_CODE (tmp) == NOP_EXPR)
+ return tmp;
+ else
+ return fold_convert (void_type_node, tmp);
}
The source of the problem was that the memcpy call
(void) __builtin_memcpy ((void *) cp.$data, (void *) &x, 8);
is being replaced at -O1 by:
(*(struct t2 * {ref-all}) SAVE_EXPR <cp.$data> = x;, (void *) SAVE_EXPR
<cp.$data>;);
which 'gfc_build_memcpy_call' was not able to cope with. I.e. the
'fold_convert' would produce an COMPOUND_EXPR, which later on would trigger the
error in 'tree_annotate_all_with_location'.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41714