[Bug fortran/25806] problems with functions returning array pointers?
eedelman at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sat Feb 4 17:11:00 GMT 2006
------- Comment #3 from eedelman at gcc dot gnu dot org 2006-02-04 17:11 -------
If I compile the original testcase with current mainline (revision 110561), the
binary dies on execution with
*** glibc detected *** double free or corruption (out): 0xbfc9d020 ***
Aborted
If I remove the line
print*,x(5)
the program runs and outputs
0.000000 0.000000 0.000000 0.000000 0.000000
This trivial patch fixes the latter problem:
---------------------
Index: trans-expr.c
===================================================================
--- trans-expr.c (revision 110590)
+++ trans-expr.c (working copy)
@@ -2912,6 +2912,9 @@ gfc_trans_arrayfunc_assign (gfc_expr * e
if (gfc_ref_needs_temporary_p (expr1->ref))
return NULL;
+ if (expr2->symtree->n.sym->attr.pointer)
+ return NULL;
+
/* Check that no LHS component references appear during an array
reference. This is needed because we do not have the means to
span any arbitrary stride with an array descriptor. This check
------------------------------------
I'll try to see if I can fix the other problem too.
--
eedelman at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |eedelman at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25806
More information about the Gcc-bugs
mailing list