DOCUMENT:Q148608 03-NOV-1999 [fortran] TITLE :BUG: Derived-Type with Pointer Expands Incorrectly in Debugger PRODUCT :Microsoft Fortran Compiler PROD/VER::4.0 OPER/SYS: KEYWORDS:kbFortranPS kbLangFortrankbbuglist ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Fortran PowerStation for Windows 95 and Windows NT, version 4.0 ------------------------------------------------------------------------------- SYMPTOMS ======== When you debug a derived-type variable that contains a pointer to another derived-type object and you try to view the members of the pointed to object in a watch window, it fails. This causes the pointer to member structure to be incorrectly expanded out. STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ Steps to Reproduce Problem -------------------------- Build the following sample code in Developer Studio with the /Zi compiler option, and then perform the following steps: 1. Begin a debugging session; On the Developer Studio Debug menu, click Build, and then click Step Into. 2. Step through the main program beyond the allocate statement. 3. In a watch window, type the variable name "root" (without the quotation marks), and press the ENTER key. 4. View the members of root. Click each of the (+) nesting symbols to expand each level of the derived-type object root. Expanding root yields root%B%L%B%L%B%L instead of the correct pointer to member structure of root%B%l%i. Typing in the correct pointer to member structure in a watch window yields the following message in the corresponding value column: Invalid structure member Sample Code ----------- C Compile options needed: /Zi module types type t_leaf integer i end type t_leaf type t_branch type (t_leaf), pointer :: l end type type t_root type (t_branch) b end type end module types program main use types implicit none type (t_root) root allocate( root%b%l ) root%b%l%i = 5 end program main Additional query words: 4.00 ====================================================================== Keywords : kbFortranPS kbLangFortran kbbuglist Technology : kbAudDeveloper kbPTProdChange kbFortranSearch kbFORTRANPower400NT Version : :4.0 ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1999.