This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/42104] [F03] runtime segfault with procedure pointer component
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Nov 2009 13:25:33 -0000
- Subject: [Bug fortran/42104] [F03] runtime segfault with procedure pointer component
- References: <bug-42104-15250@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from pault at gcc dot gnu dot org 2009-11-19 13:25 -------
Martien,
Thank you very much for this report.
I have assigned it to myself and have a non-regtested fix:
As remarked by Janus, the problem is with the array argument. The code
produced for the proc_pointer call is
parm.13.dtype = 281;
parm.13.dim[0].lbound = 1;
parm.13.dim[0].ubound = 2;
parm.13.dim[0].stride = 1;
parm.13.data = (void *) &A.12[0];
parm.13.offset = 0;
D.1402 = _gfortran_internal_pack (&parm.13);
D.1404 = funcp.p (&C.1396, D.1402);
The internal_pack should not be there, since the assumed shape formal argument
requires that a descriptor be passed. This, in its turn comes about because
the symbol funcp is not marked as being always_explicit.
(In fact, he and I had a mid-air collision on this!)
The fix is to make use of the fact a proc_pointer component call is already
detected and can be used to suppress the internal_pack. Thusly:
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (revision 153651)
+++ gcc/fortran/trans-expr.c (working copy)
@@ -2918,7 +2918,7 @@
f = (fsym != NULL)
&& !(fsym->attr.pointer || fsym->attr.allocatable)
&& fsym->as->type != AS_ASSUMED_SHAPE;
- f = f || !sym->attr.always_explicit;
+ f = f || (!sym->attr.always_explicit && !comp);
if (e->expr_type == EXPR_VARIABLE
&& is_subref_array (e))
This fixes the PR but has not been regtested. I will do this tonight. If all
is well, I will commit as obvious, although your OK would be helpful, Janus!
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org
|dot org |
Severity|major |normal
Status|NEW |ASSIGNED
Last reconfirmed|2009-11-19 10:45:21 |2009-11-19 13:25:32
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42104