Bug 30249 - Pointers not given target type in GFORTRAN
Summary: Pointers not given target type in GFORTRAN
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-debug
Depends on:
Blocks: 24546
  Show dependency treegraph
 
Reported: 2006-12-18 13:29 UTC by David Lecomber
Modified: 2010-05-08 20:30 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-12-24 05:36:28


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Lecomber 2006-12-18 13:29:58 UTC
program struct

    REAL              , POINTER :: RD(:,:) =>NULL()





    ALLOCATE(RD(10,10))



Compile with gfortran -g struct.f90

The Dwarf output for RD leads to:
 <1><10d>: Abbrev Number: 5 (DW_TAG_pointer_type)

     DW_AT_byte_size   : 4

-- there should be a type in there (there is with most other compilers..) -- otherwise we have to interpret RD as Void* instead of double*.
Comment 1 Andrew Pinski 2006-12-24 05:36:28 UTC
Confirmed.
Comment 2 Tobias Burnus 2008-09-18 20:03:33 UTC
Works for me. Can you check with a recent 4.4 compiler? There I get:

(idb) pt RD
type = REAL(4)(10)(10)

which looks OK.
Comment 3 Dominique d'Humieres 2008-09-18 21:12:43 UTC
With gdb on i686-apple-darwin9, I get either

(gdb) pt rd
type = real*4 (0:-1,0:-1)

or

(gdb) pt rd
No symbol "rd" in current context.

Comment 4 Tobias Burnus 2008-10-11 16:32:56 UTC
Jakub, I think GCC sets the wrong type for "rd". It has:

 <1><1bb>: Abbrev Number: 7 (DW_TAG_array_type)
    <1bc>   DW_AT_name  : (indirect string, offset: 0xf9): array2_real(kind=4)

whereas for ifort I get:

 <1><1fc>: Abbrev Number: 5 (DW_TAG_pointer_type)
    <1fd>   DW_AT_type        : <0x207>
    <201>   DW_AT_associated  : 5 byte block: 97 6 10 0 2e      (DW_OP_push_object_address; DW_OP_deref; DW_OP_constu: 0; DW_OP_ne)
 <1><207>: Abbrev Number: 6 (DW_TAG_array_type)

The DW_TAG_pointer_type and the DW_AT_associated should be there; gfortran has DW_AT_allocated which should not be there as there is no allocatable variable.

Or do I miss something? My DWARF knowledge is limited.


(In reply to comment #3)
> With gdb on i686-apple-darwin9, I get either

You know that gdb does not yet support variable-length arrays such as Fortran's assumed-shape arrays and C's (or was it C++'s?) VLA? This is work in progress (thanks, Jan!), see:
  http://sourceware.org/ml/gdb-patches/2008-10/msg00248.html
  http://people.redhat.com/jkratoch/vla/
Thus I was testing with the Intel Debugger (idb).
Comment 5 Daniel Franke 2010-04-30 21:11:59 UTC
Has this been WAITING for 18 months now?
Any news? :)
Comment 6 Jakub Jelinek 2010-04-30 21:34:17 UTC
It IMHO shouldn't be DW_TAG_pointer_type, it is not a C style pointer.
DW_TAG_array_type is what is emitted and what is listed in DWARF3/4 examples for Fortran code with POINTER variables.  And current GCC certainly emits DW_AT_associated rather than DW_AT_allocated for POINTER vars.

So I don't see any problem on the gfortran producer side.
Comment 7 Daniel Franke 2010-05-08 20:30:45 UTC
(In reply to comment #6)
> So I don't see any problem on the gfortran producer side.

I take this as a suggestion to close this PR.
Please reopen if misinterpreted.