From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27202 invoked by alias); 19 Nov 2009 21:09:44 -0000 Received: (qmail 27167 invoked by uid 48); 19 Nov 2009 21:09:29 -0000 Date: Thu, 19 Nov 2009 21:09:00 -0000 Message-ID: <20091119210929.27166.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/42104] [F03] runtime segfault with procedure pointer component In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "janus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-11/txt/msg01625.txt.bz2 ------- Comment #6 from janus at gcc dot gnu dot org 2009-11-19 21:09 ------- (In reply to comment #5) > 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! The question is if you want to do this for *all* PPCs. It seems the 'always_explicit' flag is correctly set for PPCs (by the same criteria as for normal procedures). Therefore I would propose the following: Index: gcc/fortran/trans-expr.c =================================================================== --- gcc/fortran/trans-expr.c (revision 154327) +++ gcc/fortran/trans-expr.c (working copy) @@ -2979,7 +2979,10 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * f = (fsym != NULL) && !(fsym->attr.pointer || fsym->attr.allocatable) && fsym->as->type != AS_ASSUMED_SHAPE; - f = f || !sym->attr.always_explicit; + if (comp) + f = f || !comp->attr.always_explicit; + else + f = f || !sym->attr.always_explicit; if (e->expr_type == EXPR_VARIABLE && is_subref_array (e)) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42104