Bug 9232 - utils.c:947: internal-error: virtual memory exhausted: can't allocate 4294967420 bytes.
Summary: utils.c:947: internal-error: virtual memory exhausted: can't allocate 4294967...
Status: REOPENED
Alias: None
Product: gdb
Classification: Unclassified
Component: fortran (show other bugs)
Version: 6.4
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-18 13:48 UTC by fkrogh
Modified: 2013-11-30 07:53 UTC (History)
7 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
test.f (151 bytes, application/octet-stream)
, fkrogh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description fkrogh 2006-05-18 13:48:01 UTC
[Converted from Gnats 2127]

test.f is attached.
g77 -g -o test test.f
gdb test
b test.f:12
run
p ii(3)
or
p (*ii)(3)
gives a fatal error.

The problem is probably due to II being declared with a dimension of *.

This problem has a terrible side effect when using ddd.  If when moving the mouse pointer around in the source window one should accidentally let it touch such an array the debug session is lost.

Release:
6.4

Environment:
Gentoo Linux, gdb-6.4-r4, dual Opteron, GNU Fortran (GCC) 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)

How-To-Repeat:
Easy, it fails every time.
Comment 1 fkrogh 2006-05-18 13:48:01 UTC
Fix:
In my ignorance, I suspect the problem might be fixed by walking up the call stack and finding the actual dimension of such an array (accounting for the offset if an array element is being passed).
Comment 2 drow@false.org 2006-05-18 13:49:25 UTC
From: Daniel Jacobowitz <drow@false.org>
To: fkrogh@mathalacarte.com
Cc: gdb-gnats@sources.redhat.com
Subject: Re: fortran/2127: utils.c:947: internal-error: virtual memory exhausted: can't allocate 4294967420 bytes.
Date: Thu, 18 May 2006 09:49:25 -0400

 On Thu, May 18, 2006 at 01:42:29PM -0000, fkrogh@mathalacarte.com wrote:
 > p (*ii)(3)
 > gives a fatal error.
 > 
 > The problem is probably due to II being declared with a dimension of *.
 
 Could you please try a GDB 6.5 prerelease?  I'm not sure, but I believe
 Wu fixed this problem.
 
 -- 
 Daniel Jacobowitz
 CodeSourcery

Comment 3 fkrogh 2006-05-18 16:38:12 UTC
From: Fred Krogh <fkrogh@mathalacarte.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-gnats@sources.redhat.com
Subject: Re: fortran/2127: utils.c:947: internal-error: virtual memory exhausted:
 can't allocate 4294967420 bytes.
Date: Thu, 18 May 2006 09:38:12 -0700

 Daniel Jacobowitz wrote:
 > On Thu, May 18, 2006 at 01:42:29PM -0000, fkrogh@mathalacarte.com wrote:
 >   
 >> p (*ii)(3)
 >> gives a fatal error.
 >>
 >> The problem is probably due to II being declared with a dimension of *.
 >>     
 >
 > Could you please try a GDB 6.5 prerelease?  I'm not sure, but I believe
 > Wu fixed this problem.
 >
 >   
 Just checked with GNU gdb 6.4.50.20060515-cvs
 and got exactly the same problem.
 Thanks,
    Fred

Comment 4 fkrogh 2006-05-31 19:08:02 UTC
From: Fred Krogh <fkrogh@mathalacarte.com>
To: gdb-gnats@sources.redhat.com,  nobody@sources.redhat.com, 
 fkrogh@mathalacarte.com,  gdb-prs@sources.redhat.com
Cc:  
Subject: Re: fortran/2127: utils.c:947: internal-error: virtual memory exhausted:
 can't allocate 4294967420 bytes.
Date: Wed, 31 May 2006 12:08:02 -0700

 http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=2127
 
 Just checked on this after another crash, and discovered that I had not
 used a 6.5 prerelease, even though at that time I thought I had the
 latest prerelease.  I just tried the current latest and have exactly the
 same problem.  /usr/local/bin/gdb --version gives
 
 GNU gdb 6.5.50.20060529-cvs
 ...

Comment 5 fkrogh 2006-06-07 23:49:26 UTC
From: Fred Krogh <fkrogh@mathalacarte.com>
To: gdb-gnats@sources.redhat.com,  fkrogh@mathalacarte.com, 
 gdb-prs@sources.redhat.com
Cc:  
Subject: Re: fortran/2127: utils.c:947: internal-error: virtual memory exhausted:
 can't allocate 4294967420 bytes.
Date: Wed, 07 Jun 2006 16:49:26 -0700

 http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=2127
 
 I've just installed gfortran which was recently unmasked in Gentoo.  The
 problem is not present when using GNU Fortran 95 (GCC) 4.1.1 (Gentoo
 4.1.1). Just in case, if anyone knows what needs to be said to get ddd
 to display part of an array or all or part of a dummy array, I'd love to
 know the incantation.  Printing works, display doesn't except for a
 display of all of an array that is not a formal argument. Thanks,
 Fred
Comment 6 Tom Tromey 2013-04-12 17:02:39 UTC
This seems to work for me now.
So, I'm closing the PR.
If it is still a bug for you, please file more details
and reopen.
Thanks.
Comment 7 Fred Krogh 2013-04-12 17:26:20 UTC
I'm not getting failures now, but the following seems a little strange to me.  I have stopped at the return on line 12.  And ...

(gdb) p ii(1:5)
slice out of range
(gdb) p ii(1)@5
$6 = (1, 2, 3, 4, 5)

Perhaps this is considered normal?  It's certainly something I can live with.
Many thanks for looking into this.  Frankly, I'd forgotten about it.
Comment 8 Tom Tromey 2013-04-12 19:34:17 UTC
(In reply to comment #7)
> I'm not getting failures now, but the following seems a little strange to me. 
> I have stopped at the return on line 12.  And ...
> 
> (gdb) p ii(1:5)
> slice out of range
> (gdb) p ii(1)@5
> $6 = (1, 2, 3, 4, 5)
> 
> Perhaps this is considered normal?

I don't know -- I don't know Fortran :)
The usual rule is that gdb should follow the language rules.
So if that is valid Fortran then I think it is a bug.
Comment 9 Sergio Durigan Junior 2013-04-24 20:00:22 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > I'm not getting failures now, but the following seems a little strange to me. 
> > I have stopped at the return on line 12.  And ...
> > 
> > (gdb) p ii(1:5)
> > slice out of range
> > (gdb) p ii(1)@5
> > $6 = (1, 2, 3, 4, 5)
> > 
> > Perhaps this is considered normal?
> 
> I don't know -- I don't know Fortran :)
> The usual rule is that gdb should follow the language rules.
> So if that is valid Fortran then I think it is a bug.

I don't know Fortran either, but I found the following page:

<https://www.mcs.anl.gov/~itf/dbpp/text/node84.html>

which uses and explains the concept.  So I believe it is valid Fortran, yes.