This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix pr23046
- From: Richard Henderson <rth at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 19 Sep 2005 11:17:27 -0700
- Subject: Re: [patch] Fix pr23046
- References: <10509191040.AA08500@vlsi1.ultra.nyu.edu>
On Mon, Sep 19, 2005 at 06:40:09AM -0400, Richard Kenner wrote:
> One can argue that there are in fact holes with this scheme, e.g.
>
> (A) memset (&u, -1, sizeof (u));
> (B) __asm__ ("mov $-1, %0" : "=r"(u));
>
> i.e. any assignment to these variables not under direct control of
> the compiler, such that the value of U in its full mode after the
> statement is not confined to the bounds of its partial mode type.
>
> Why not just argue that those are invalid?
Because I'm not sure that's true. I'll leave that argument for
a C++ language lawyer.
> It seems like that's defining what an overflow would do when assigning to a
> bitfield. But isn't that undefined too?
No. Neither is a copy from unsigned long to unsigned char. It's
the same thing.
r~