Summary: | [F03] Wrong result for a pointer to a proc-pointer component | ||
---|---|---|---|
Product: | gcc | Reporter: | Tobias Burnus <burnus> |
Component: | fortran | Assignee: | janus |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | janus, xarthisius.kk |
Priority: | P3 | Keywords: | wrong-code |
Version: | 4.7.0 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2011-11-10 00:00:00 |
Description
Tobias Burnus
2011-11-10 14:56:59 UTC
Note: The following variant works. program ala implicit none type process_list procedure(ala1), pointer, nopass :: process end type type(process_list), target :: p_list type(process_list), pointer :: p real :: r p_list%process => ala1 p => p_list r = p%process(1.0) write(*,*) r contains real function ala1(x) real, intent(in) :: x ala1 = x end function ala1 end program ala Fix: Index: gcc/fortran/trans-expr.c =================================================================== --- gcc/fortran/trans-expr.c (revision 181240) +++ gcc/fortran/trans-expr.c (working copy) @@ -5019,7 +5019,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * e && ((expr->value.function.esym && expr->value.function.esym->result->attr.pointer && !expr->value.function.esym->result->attr.dimension) - || (!expr->value.function.esym + || (!expr->value.function.esym && !expr->ref && expr->symtree->n.sym->attr.pointer && !expr->symtree->n.sym->attr.dimension))) { Note: The patch in comment #2 regtests cleanly. Author: janus Date: Sun Apr 15 11:47:49 2012 New Revision: 186465 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186465 Log: 2012-04-15 Janus Weil <janus@gcc.gnu.org> PR fortran/51082 * trans-expr.c (gfc_conv_expr_reference): Check if the expression is a simple function call (or a more involved PPC reference). 2012-04-15 Janus Weil <janus@gcc.gnu.org> PR fortran/51082 * gfortran.dg/proc_ptr_comp_34.f90: New test case. Added: trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_34.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-expr.c trunk/gcc/testsuite/ChangeLog |