Bug 24546

Summary: [meta-bug] gfortran debugging problems
Product: gcc Reporter: Thomas Koenig <tkoenig>
Component: fortranAssignee: Not yet assigned to anyone <unassigned>
Status: NEW ---    
Severity: normal CC: gcc-bugs, langton, P.Schaffnit, steven, woodzltc
Priority: P2 Keywords: meta-bug, wrong-debug
Version: 4.1.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2007-03-03 12:06:04
Bug Depends on: 37134, 49475, 49565, 49566, 54503, 56626, 59263, 59438, 78212, 10220, 17905, 20112, 22244, 23057, 23280, 24526, 24527, 24790, 29635, 29697, 30249, 33179, 34153, 37132, 37133, 37826, 40040, 40660, 40823, 41143, 41359, 43414, 47797, 63331, 68889, 71906, 77865, 78059, 87969    
Bug Blocks: 19292    

Description Thomas Koenig 2005-10-26 18:17:36 UTC
This is a meta-bug to catch all gfortran debugging problems.
Comment 1 Andrew Pinski 2005-10-27 23:32:19 UTC
From the looks of it, some of these are really gdb issues as they work when you do:
set lang c

Comment 2 Wu Zhou 2005-10-28 04:51:26 UTC
Yes. Some of these problems stems from gdb, like 24527; others from gfortran, like 22244, and yet others involve both. 

I could spare some time to work on fortran support in gdb.  And very willing to work with gfortran community to make progress on that.
Comment 3 Andrew Pinski 2005-11-10 04:04:41 UTC
There is a gfortran bug not listed here yet (I am too lazy to file a new bug).
Anyways the bug is that the type for arguments is wrong and gives you instead a reference (in the C++ sense) type instead of a normal type.  I think I might have a way to fix that.  If someone wants to file that bug and assign it to me, that would be nice.
Comment 4 Wu Zhou 2005-11-11 09:18:48 UTC
Hi Andrew,

I opened PR 24790 to track this.  Wish that it is just what you thought of.  But I didn't figure out how to assign that to you.  So I add you the cc list.

Regards
- Wu Zhou
Comment 5 Janne Blomqvist 2005-11-21 16:01:50 UTC
Just as a general note, the deadline for dwarf3 comments is Dec 1, 2005.  So if anyone with some clue about how to improve support for debugging fortran has some good suggestions that would require changes in the debug format, now is the time to send them.
Comment 6 Wu Zhou 2005-11-22 03:49:08 UTC
I ever opened an issue to request to add something to identify the main function (such as Fortran MAIN__) in a program.  But that is deferred to DWARF 4.  So maybe now it is too late to add anything into DWARF 3.

Here is the link
http://dwarf.freestandards.org/ShowIssue.php?issue=050808.2&type=closed
Comment 7 Francois-Xavier Coudert 2007-03-03 12:06:04 UTC
Steven Bosscher had made significant progress on this, IIRC. Steven, what's the status of your patches?

PS: as a minor improvement, we might want to give numeric types a more Fortran-like name, with a patch such as the following:

Index: trans-types.c
===================================================================
--- trans-types.c       (revision 122038)
+++ trans-types.c       (working copy)
@@ -531,7 +531,7 @@
     {
       type = gfc_build_int_type (&gfc_integer_kinds[index]);
       gfc_integer_types[index] = type;
-      snprintf (name_buf, sizeof(name_buf), "int%d",
+      snprintf (name_buf, sizeof(name_buf), "integer(kind=%d)",
                gfc_integer_kinds[index].kind);
       PUSH_TYPE (name_buf, type);
     }
@@ -540,7 +540,7 @@
     {
       type = gfc_build_logical_type (&gfc_logical_kinds[index]);
       gfc_logical_types[index] = type;
-      snprintf (name_buf, sizeof(name_buf), "logical%d",
+      snprintf (name_buf, sizeof(name_buf), "logical(kind=%d)",
                gfc_logical_kinds[index].kind);
       PUSH_TYPE (name_buf, type);
     }
@@ -549,13 +549,13 @@
     {
       type = gfc_build_real_type (&gfc_real_kinds[index]);
       gfc_real_types[index] = type;
-      snprintf (name_buf, sizeof(name_buf), "real%d",
+      snprintf (name_buf, sizeof(name_buf), "real(kind=%d)",
                gfc_real_kinds[index].kind);
       PUSH_TYPE (name_buf, type);
 
       type = gfc_build_complex_type (type);
       gfc_complex_types[index] = type;
-      snprintf (name_buf, sizeof(name_buf), "complex%d",
+      snprintf (name_buf, sizeof(name_buf), "complex(kind=%d)",
                gfc_real_kinds[index].kind);
       PUSH_TYPE (name_buf, type);
     }
Comment 8 Thomas Koenig 2007-05-20 22:20:14 UTC
(In reply to comment #7)

> PS: as a minor improvement, we might want to give numeric types a more
> Fortran-like name, with a patch such as the following:

...

Hi FX,

are you planning to submit that patch?  It sounds like a good idea.
Comment 9 Dominique d'Humieres 2015-10-29 13:37:09 UTC
> Hi FX,
>
> are you planning to submit that patch?  It sounds like a good idea.

This patch seems to have been committed at least since 4.7.