Re: enums and EXPR_VALUE and sign expansion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 23, 2019 at 03:16:56PM -0700, Linus Torvalds wrote:
> Luc - I _suspect_ that what happens is that it now does that
> 
>                 expr->ctype = base_type;
> 
> in parse.c, which is correct in the long run, but AT THE TIME it is
> parsed, the type hasn't been finalized yet. That's fine - we'll fix it
> in-place eventually.
> 
> HOWEVER. We also do this:
> 
>                 if (ctype->bit_size == base_type->bit_size)
>                         continue;
>                 cast_value(expr, base_type, expr, ctype);
> 
> and I think it's that 'cast_value()' that gets things wrong somehow.
> It probably uses a 'unsigned int' either as the source or the
> destination, or something.

Thanks, Linus.

That was the problem.  get_longlong(old) has to have the original ctype.

regards,
dan carpenter



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux