Re: defining big types on avr-gcc

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

 



On 08/04/2010 09:58 AM, Massimiliano Cialdi wrote:
> Il giorno mar, 03/08/2010 alle 17.03 +0100, Andrew Haley ha scritto:
>>> This looks incredible to me. I wonder why.
>>> Is it a bug?
>>
>> I don't think it is.  gcc uses ssize_t (or, to be precise, a signed
>> integer type beased on sizetype) internally when constructing the size
>> of an array.  Given that array offsets can be negative or positive.
>> this seems reasonable enough.
> 
> So why if I write:
> big_dummy_t *p = (big_dummy_t*)0;
> uint16_t p = (uint16_t)&(p->singledata);
> 
> I get NO warning?

Because the first is constant folded, the second isn't.  Not that it
matters, because your program is undefined anyway, since you're
dereferencing a null pointer.

Andrew.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux