On Tue, 15 Jan 2008, Michael Matz wrote:
> Doing arithmetic on small bit-fields on the (larger) promoted type, but
> doing them on large bit-fields on the exact width creates an asymmetry.
It's the same as arithmetic on unsigned short actually being done on the
promoted type (signed int), whi
Hi,
On Tue, 15 Jan 2008, Joseph S. Myers wrote:
> On Mon, 14 Jan 2008, Richard Guenther wrote:
>
> > Can you clarify on the resulting promotions? As I remember the
> > standard defines promotions based on the representable values, so
> > long : 15 gets promoted to int, but long : 33 doesn't get
On Tue, 15 Jan 2008, Joseph S. Myers wrote:
> On Mon, 14 Jan 2008, Richard Guenther wrote:
>
> > Can you clarify on the resulting promotions? As I remember the
> > standard defines promotions based on the representable values, so
> > long : 15 gets promoted to int, but long : 33 doesn't get prom
On Mon, 14 Jan 2008, Richard Guenther wrote:
> Can you clarify on the resulting promotions? As I remember the
> standard defines promotions based on the representable values, so
> long : 15 gets promoted to int, but long : 33 doesn't get promoted.
> In the C++ FE at least we promote to the _decla
On Jan 14, 2008, Richard Guenther <[EMAIL PROTECTED]> wrote:
> The question arises when computing the value of say long : 33 i;
> i << 16 >> 16. Is the shift performed in long : 33 type? Is an
> out-of-range value truncated?
If truncation makes any difference, then there must have been
overflow
On Mon, 14 Jan 2008, Joseph S. Myers wrote:
> On Mon, 14 Jan 2008, Richard Guenther wrote:
>
> > - document how integral promotion is performed on the implementation
> >defined bitfields we allow as a GNU extension. (4.9, "Integer
> >promotion rules are extended for non-standard bit-fie
On Mon, 14 Jan 2008, Richard Guenther wrote:
> - document how integral promotion is performed on the implementation
>defined bitfields we allow as a GNU extension. (4.9, "Integer
>promotion rules are extended for non-standard bit-field types to
>promote to the smallest integer type t
Consider
struct s { long a : 33; };
long bar(struct s *x) { return (x->a << 16) >> 16; }
extern void abort(void);
int main()
{
struct s a = { 1u << 31 };
if (bar(&a) != 0)
abort ();
return 0;
}
where we currently (rightfully so, IMHO) abort.
There are several prob