[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: x86_64: malloc returns erroneous pointer with large argument
From: |
Andreas Schwab |
Subject: |
Re: x86_64: malloc returns erroneous pointer with large argument |
Date: |
Thu, 15 Jan 2004 10:28:18 +0100 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux) |
"Bording, Jan" <address@hidden> writes:
> This error is for x86_64 only !!
You will also get this on ia64. Fix your program.
> ~>cat test.c
> #include <stdio.h>
#include <stdlib.h>
>
> main()
> {
> int n;
> double **A,**B;
>
> A = (double **)malloc(16000*sizeof(double *));
> B = (double **)malloc(32000*sizeof(double *));
>
> A[3] = (double *)malloc(1*sizeof(double));
> B[3] = (double *)malloc(1*sizeof(double));
> }
>
> ~> gcc -o test test.c -lm
> test.c: In function `main':
> test.c:8: warning: cast to pointer from integer of different size
> test.c:9: warning: cast to pointer from integer of different size
> test.c:11: warning: cast to pointer from integer of different size
> test.c:12: warning: cast to pointer from integer of different size
Never ignore warnings.
Andreas.
--
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."