This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: don't assume pointer cast to unsigned long is a valid initializer
- From: Geoff Keating <geoffk at geoffk dot org>
- To: Alexandre Oliva <aoliva at redhat dot com>, rth at redhat dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 28 Feb 2003 14:12:50 -0800
- Subject: Re: don't assume pointer cast to unsigned long is a valid initializer
- References: <orznogn7qt.fsf@free.redhat.lsd.ic.unicamp.br>
Alexandre Oliva <aoliva at redhat dot com> writes:
> +++ gcc/testsuite/gcc.c-torture/compile/20010327-1.c 28 Feb 2003 08:12:12 -0000
> @@ -1,2 +1,6 @@
> extern void _text;
> -static unsigned long x = (unsigned long) &_text - 0x10000000L - 1;
> +/* We use __SIZE_TYPE__ here because it's as wide as a pointer, so we
> + know we won't have a non-constant because of extension or
> + truncation of the pointer to fit. */
> +static __SIZE_TYPE__ x
> + = (__SIZE_TYPE__) &_text - (__SIZE_TYPE__) 0x10000000L - 1;
Not OK. See the CVS log and mailing list archives for why.
Please back out your change.
--
- Geoffrey Keating <geoffk at geoffk dot org>