[Bug c/84764] Wrong warning "so large that it is unsigned" for __int128 constant

2023-01-25 Thread daniel.lundin.mail at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84764

--- Comment #6 from Daniel Lundin  ---
Call it what you will, either way there is nothing here that's "so large that
it is unsigned". The main point is that the diagnostic message is wrong.

typeof(18446744073709551615) x = -1;

Gives a 128 bit integer type with the value -1. If it was "so large that it is
unsigned" then this would have resulted in an unsigned type with an unsigned
value. The diagnostic message is plain wrong and misleading.

[Bug c/84764] Wrong warning "so large that it is unsigned" for __int128 constant

2023-01-25 Thread joseph at codesourcery dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84764

--- Comment #5 from joseph at codesourcery dot com  ---
Also, for it to become an extended integer type, it would be necessary to 
define integer constant suffixes and implement printf / scanf support in 
the library, because  is now required to provide intN_t / 
uintN_t when there is a matching standard or extended integer type, so 
would be required to provide int128_t / uint128_t, which in turn would 
require the corresponding  and  macros, so requiring 
constant suffixes and printf / scanf support.

[Bug c/84764] Wrong warning "so large that it is unsigned" for __int128 constant

2023-01-25 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84764

--- Comment #4 from Jonathan Wakely  ---
(In reply to Daniel Lundin from comment #3)
> gcc behaves just like required too, since `__int128` ought to be one of the
> extended integer types and it is signed.

But it's not an extended integer type, see comment 2.

I think that will change for C23, which allows intmax_t to be be defined to
long long even if there are larger extended integer types. But in GCC today,
there are no extended integer types.

[Bug c/84764] Wrong warning "so large that it is unsigned" for __int128 constant

2023-01-25 Thread daniel.lundin.mail at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84764

Daniel Lundin  changed:

   What|Removed |Added

 CC||daniel.lundin.mail at gmail 
dot co
   ||m

--- Comment #3 from Daniel Lundin  ---
This is a bug as in the wrong text is displayed in the diagnostic message. gcc
picks `__int128` and it is not an unsigned type.

Decimal integer constants use the the quoted list in 6.4.4.1: `int` then `long`
then `long long`. Therefore this normative text (from C99 to C23) applies: "If
all of the types in the list for the constant are signed, the extended integer
type shall be signed."

gcc behaves just like required too, since `__int128` ought to be one of the
extended integer types and it is signed.

I would guess this message is some remain from C90 where extended integer types
didn't exist. Compiling with -std=c90 adds an additional warning "warning: this
decimal constant is unsigned only in ISO C90". It would appear that this is the
correct warning that should always be displayed. Seems to be a minor bug that
occurred during the switch (gcc 5.0.0) from gnu90 to gnu11 as default option.

[Bug c/84764] Wrong warning "so large that it is unsigned" for __int128 constant

2018-03-08 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84764

--- Comment #2 from Andrew Pinski  ---
__int128 is not an extended integer type in the C sense.  The main reason is
because intmax_t is not defined as __int128.

[Bug c/84764] Wrong warning "so large that it is unsigned" for __int128 constant

2018-03-08 Thread pascal_cuoq at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84764

--- Comment #1 from Pascal Cuoq  ---
I meant "the warning implies that the constant is typed as unsigned long
long...".