Bug 45456 - [4.6 Regression] [OOP] Bogus pointer initialization error on pointer-valued TBP
[4.6 Regression] [OOP] Bogus pointer initialization error on pointer-valued TBP
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: fortran
4.6.0
: P3 normal
: ---
Assigned To: janus
: rejects-valid
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-08-30 20:30 UTC by janus
Modified: 2010-08-30 21:58 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-08-30 20:36:16


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description janus 2010-08-30 20:30:02 UTC
Reported by Andrew Benson at http://gcc.gnu.org/ml/fortran/2010-08/msg00462.html:


module Merger_Trees
  private
  public :: mergerTree

  type mergerTree
   contains
     procedure :: getNode => Tree_Node_Get
  end type mergerTree

contains

  function Tree_Node_Get(thisTree,nodeIndex) result(foundNode)
    implicit none
    class(mergerTree), intent(inout) :: thisTree
    integer,           intent(in)    :: nodeIndex
    integer,           pointer       :: foundNode

    return
  end function Tree_Node_Get

end module Merger_Trees


gives:


<During initialization>

Error: Pointer initialization target at (1) must have the SAVE attribute
Comment 1 janus 2010-08-30 20:36:16 UTC
Here' the fix:

Index: resolve.c
===================================================================
--- resolve.c   (revision 163648)
+++ resolve.c   (working copy)
@@ -1083,7 +1083,8 @@
                     comp->name);
        }
 
-      if (!comp->attr.pointer || cons->expr->expr_type == EXPR_NULL)
+      if (!comp->attr.pointer || comp->attr.proc_pointer
+         || cons->expr->expr_type == EXPR_NULL)
        continue;
 
       a = gfc_expr_attr (cons->expr);
Comment 2 janus 2010-08-30 21:56:52 UTC
Subject: Bug 45456

Author: janus
Date: Mon Aug 30 21:56:28 2010
New Revision: 163661

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163661
Log:
2010-08-30  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/45456
	* resolve.c (resolve_structure_cons): Handle pointer-valued PPCs.


2010-08-30  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/45456
	* gfortran.dg/typebound_proc_18.f03: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/typebound_proc_18.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 janus 2010-08-30 21:58:47 UTC
Fixed with r163661. Closing.