On Nov 25, 2007, at 9:48 AM, Chris Lattner wrote:

>
> On Nov 25, 2007, at 9:39 AM, Nuno Lopes wrote:
>
>> Hi,
>>
>> Expr::isIntegerConstantExpr() seems to return bogus results with the
>> sizeof() operator.
>> For example, for input "21-2*2+4", it returns 21 as expected
>> but with sizeof:
>>
>> int buf_src[4];
>> sizeof(buf_src) => 128 (4 * 4 * 8 bits)
>> sizeof(buf_src)-sizeof(buf_src)/sizeof(*buf_src) => 124 (???)
>>
>> So it seems that sizeof() is being computed in bits, but then the
>> operations aren't consistent. (in fact it should be computed in  
>> bytes,
>> as that's the value of that operator in C/C++)
>
> Yep, you're right, applied, thanks!
>
> -Chris

Should the fix instead go in the body of getTypeSize() instead of  
within isConstantExpr()?  Should getTypeSize() ever return the number  
of bits instead of the number of bytes?  Does this have something to  
do with bitfields?
_______________________________________________
cfe-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

Reply via email to