public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "harald at gigawatt dot nl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/100805] __int128 should be disabled for non-extended -std= options
Date: Thu, 27 May 2021 22:32:20 +0000	[thread overview]
Message-ID: <bug-100805-4-2mZNcXJdGA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100805-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100805

Harald van Dijk <harald at gigawatt dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |harald at gigawatt dot nl

--- Comment #2 from Harald van Dijk <harald at gigawatt dot nl> ---
(In reply to Andreas Schwab from comment #1)
> The C++ standard says: [lex.icon] "If an integer literal cannot be
> represented by any type in its list and an extended integer type (6.8.1) can
> represent its value, it may have that extended integer type."

__int128 behaves mostly like an integer type but is not an "extended integer
type" as defined in the standard. Quoting from
https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html: "GCC does not
support any extended integer types." Extended integer types must meet specific
requirements that __int128 does not meet: extended integer types cannot be
larger than intmax_t, and __int128 is.

Despite __int128 not being an extended integer type, there is nothing wrong
with having __int128 enabled in standards-conforming mode. Out-of-range
constants must be diagnosed, but they already are, and continuing to accept the
program after that is valid.

The warning that is generated for the out-of-range constant is highly
misleading though: the warning says "integer constant is so large that it is
unsigned". Either the constant should be given an unsigned type, or the warning
should be updated to reflect the type the constant actually gets.

  parent reply	other threads:[~2021-05-27 22:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 20:39 [Bug c++/100805] New: " dje at gcc dot gnu.org
2021-05-27 21:36 ` [Bug c++/100805] " schwab@linux-m68k.org
2021-05-27 22:32 ` harald at gigawatt dot nl [this message]
2021-05-28 16:38 ` redi at gcc dot gnu.org
2023-08-08 10:19 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100805-4-2mZNcXJdGA@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).