Message ID | BANLkTi=yQDZZMgPU1piEiQuoMZbVkeiXmQ@mail.gmail.com |
---|---|
State | New |
Headers | show |
Ping ... ! 2011/6/28 Janus Weil <janus@gcc.gnu.org>: > Hi all, > > here is a patch for a problem which was originally reported as an > ICE-on-invalid regression (assigning to a type-bound function). > > In the course of fixing it, I noticed that it becomes valid according > to F08 if the function is pointer-valued, and modified the patch such > that it will accept this variant. I also adapted the original test > case to be a run-time test of this F08 feature (in fact it is just a > very complicated way of performing an increment from 0 to 1, and would > still segfault without the patch). > > The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk and 4.6.2? > > Cheers, > Janus > > > > 2011-06-28 Janus Weil <janus@gcc.gnu.org> > > PR fortran/49562 > * expr.c (gfc_check_vardef_context): Handle type-bound procedures. > > > 2011-06-28 Janus Weil <janus@gcc.gnu.org> > > PR fortran/49562 > * gfortran.dg/typebound_proc_23.f90: New. >
OK for trunk and 4.6. Thanks for the patch Paul On Tue, Jun 28, 2011 at 5:40 PM, Janus Weil <janus@gcc.gnu.org> wrote: > Hi all, > > here is a patch for a problem which was originally reported as an > ICE-on-invalid regression (assigning to a type-bound function). > > In the course of fixing it, I noticed that it becomes valid according > to F08 if the function is pointer-valued, and modified the patch such > that it will accept this variant. I also adapted the original test > case to be a run-time test of this F08 feature (in fact it is just a > very complicated way of performing an increment from 0 to 1, and would > still segfault without the patch). > > The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk and 4.6.2? > > Cheers, > Janus > > > > 2011-06-28 Janus Weil <janus@gcc.gnu.org> > > PR fortran/49562 > * expr.c (gfc_check_vardef_context): Handle type-bound procedures. > > > 2011-06-28 Janus Weil <janus@gcc.gnu.org> > > PR fortran/49562 > * gfortran.dg/typebound_proc_23.f90: New. >
> OK for trunk and 4.6. Thanks, Paul. Committed to trunk as r175779. Will apply to the 4.6 branch in a few days. Cheers, Janus > On Tue, Jun 28, 2011 at 5:40 PM, Janus Weil <janus@gcc.gnu.org> wrote: >> Hi all, >> >> here is a patch for a problem which was originally reported as an >> ICE-on-invalid regression (assigning to a type-bound function). >> >> In the course of fixing it, I noticed that it becomes valid according >> to F08 if the function is pointer-valued, and modified the patch such >> that it will accept this variant. I also adapted the original test >> case to be a run-time test of this F08 feature (in fact it is just a >> very complicated way of performing an increment from 0 to 1, and would >> still segfault without the patch). >> >> The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk and 4.6.2? >> >> Cheers, >> Janus >> >> >> >> 2011-06-28 Janus Weil <janus@gcc.gnu.org> >> >> PR fortran/49562 >> * expr.c (gfc_check_vardef_context): Handle type-bound procedures. >> >> >> 2011-06-28 Janus Weil <janus@gcc.gnu.org> >> >> PR fortran/49562 >> * gfortran.dg/typebound_proc_23.f90: New. >> > > > > -- > The knack of flying is learning how to throw yourself at the ground and miss. > --Hitchhikers Guide to the Galaxy >
Index: gcc/fortran/expr.c =================================================================== --- gcc/fortran/expr.c (revision 175580) +++ gcc/fortran/expr.c (working copy) @@ -4394,8 +4394,8 @@ gfc_check_vardef_context (gfc_expr* e, bool pointe sym = e->value.function.esym ? e->value.function.esym : e->symtree->n.sym; } - if (!pointer && e->expr_type == EXPR_FUNCTION - && sym->result->attr.pointer) + attr = gfc_expr_attr (e); + if (!pointer && e->expr_type == EXPR_FUNCTION && attr.pointer) { if (!(gfc_option.allow_std & GFC_STD_F2008)) { @@ -4432,7 +4432,6 @@ gfc_check_vardef_context (gfc_expr* e, bool pointe /* Find out whether the expr is a pointer; this also means following component references to the last one. */ - attr = gfc_expr_attr (e); is_pointer = (attr.pointer || attr.proc_pointer); if (pointer && !is_pointer) {