This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c/492: Malloc returns invalid pointers



>Number:         492
>Category:       c
>Synopsis:       Malloc returns invalid pointers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 28 07:16:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Peter Dufault
>Release:        h8300-hms 97r1a
>Organization:
>Environment:
NT 4.0 PC. Gnu tools are from the Hitachi EDK2357F development system CD-ROM.  
>Description:
The malloc() function returns invalid pointers. 

I added the following to the link.cmd file:
MEMORY
{
	ram : o = 0x200000, l = 0x40000
}

The output map file shows:
Memory Configuration

Name             Origin             Length            
ram              0x00200000         0x00040000
*default*        0x00000000         0xffffffff


The main() function is very simple. It allocates a block of 1024 bytes 3 times and prints out the address. Here is the output of the program:

malloc eBmem: 4126930605
malloc eBmem: 4126931629
malloc eBmem: 4126932653
eBmem force: 2363392

Points of interest:
1) The pointers advance in units of 1024 as expected.
2) The pointers are not on 8 byte boundaries.
3) The area pointed to is not in the range specified for the ram area.

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]