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: [patch] Fix pr23046


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~


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