Re: __typeof__ (const int)

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

 



Thank you Jonathan for your reply.

>> Hi,
>>
>> What does control or what is the rule for the type returned by
>> __typeof__ (const int) ?
> The type of a const int is ... a const int, of course.
>
> I assume you mean integer constant, not "const int".
Yes, sorry, I meant const_int rtx...
>
>> On a private target (using newlib-stdint.h), sizeof(__typeof__ (-32768))
>> returns 4 but sizeof(__typeof__ (-32767)) returns 2...
> This has nothing to do with __typeof__ only to do with the rules of C
> that determine the type of an integer constant,  see
> http://en.cppreference.com/w/c/language/integer_constant#The_type_of_the_integer_constant
>
> Presumably your private port has a 16-bit int, so -32768 doesn't fit
> in int and has a 32-bit type instead. If that's not the case then you
> have a bug in the port and it's selecting the wrong type for the
> integer constant -32767.
Yes indeed, the private target has HI int.
The pb is that both -32768 (0x8000) and 32767 should fit into an int (an
int16_t actually), and the newlib <stdlib.h> defines INT16_MIN as -32768 .
This makes gcc.gd/stdint-x.h fail...

The first tree dumps show SI const/type instead of HI. Is it the parser
which computes the type?

Aurélien



[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