This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c/492: Malloc returns invalid pointers
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/492: Malloc returns invalid pointers
- From: peter dot dufault at mn dot efi dot com
- Date: 28 Aug 2000 14:14:48 -0000
- Reply-To: peter dot dufault at mn dot efi dot com
- Resent-Cc: gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, peter.dufault@mn.efi.com
>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: