[patch] Fix pr23046

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Mon Sep 19 10:37:00 GMT 2005


    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?

I must say that I don't completely understand reduce_to_bit_field_precision.
It seems like that's defining what an overflow would do when assigning to a
bitfield.  But isn't that undefined too?  If I have a three bit field and
I assign 25 to it, that's an error.  I don't think it's a problem that the
result generated from this error depends on whether (e.g.) SRA is applied
to that field or not.



More information about the Gcc-patches mailing list