This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Could egcs warn at (int*)(int)(x)?
- To: egcs at cygnus dot com
- Subject: Re: Could egcs warn at (int*)(int)(x)?
- From: Richard Henderson <rth at cygnus dot com>
- Date: Mon, 15 Dec 1997 10:27:44 -0800
- References: <9712151734.AA15549@occam.informatik.uni-dortmund.de>
- Reply-To: egcs at cygnus dot com
On Mon, Dec 15, 1997 at 06:34:46PM +0100, Tobias Polzin wrote:
> Is there any possibility to get warnings for things like:
> int* foo=(int*)((int)bar + delta);
We do already, and have done so for quite some time. No extra
warning flags are necessary, c.f. "gcc -c z.c":
void f(int *bar, int delta)
{
int* foo=(int*)((int)bar + delta);
}
z.c: In function `f':
z.c:3: warning: cast from pointer to integer of different size
z.c:3: warning: cast to pointer from integer of different size
> Or even for
> int delta= long(newaddress)-long(oldaddress).
Maybe, but I always found these loss of precision warnings to
be more annoying than helpful. It happens way too often in
normal code.
Almost all 64-bit errors are caught by the ptr/int warnings.
r~