This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: don't assume pointer cast to unsigned long is a valid initializer


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>


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