https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111689
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to gyumin from comment #4) > I'm trying to understand how the type of a hex constant is determined in C. > According to the C standard, when a hex constant has the LL suffix, it > should first check if the value fits within the range of a long long int > before checking if it fits within the range of an unsigned long long int. > > Given the constant 0x8F3700142F89C2A5LL, which corresponds to the value > -8,127,026,915,869,867,355, it seems that this value should fit within the > range of a signed long long int, which is from -9,223,372,036,854,775,808 to > 9,223,372,036,854,775,807. If that's the case, why do gcc, clang interpret > it as an unsigned long long int? > > Could you clarify this behavior? No, there is no negative literals. So when a value like 0x8F3700142F89C2A5 happens, it is see if it fits in (positive) signed long long and since it is greater than 9,223,372,036,854,775,807, it chooses unsigned long long.