public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <joseph@codesourcery.com>
To: DJ Delorie <dj@redhat.com>
Cc: <richard.guenther@gmail.com>, <gcc@gcc.gnu.org>
Subject: Re: proposal to make SIZE_TYPE more flexible
Date: Thu, 09 Jan 2014 03:23:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.1401090214160.8625@digraph.polyomino.org.uk> (raw)
In-Reply-To: <201401090031.s090VGm9003938@greed.delorie.com>

On Wed, 8 Jan 2014, DJ Delorie wrote:

> > I think a patch is more useful once believe feature-complete, which
> > means replacing the __int128 support with the new mechanism.
> 
> One of the side-effects of taking out the existing __int128 support is
> that __int128 isn't in the integer_type_kind list, so isn't a type
> that is usable for constants.  This breaks int128-4.C, which assumes a
> 128-bit integer constant.  If I add generic support for intN types in

I don't see constants in that test.

It's not possible to write constants of type __int128 anyway.  It *is* 
possible to build them up using expressions casting narrower constants to 
__int128.  If you write a constant with a large value (with or without a 
suffix) that won't fit in target intmax_t / uintmax_t (or target long / 
unsigned long for C90), then you should get a pedwarn (and some larger 
type, maybe widest_integer_literal_type_node / 
widest_unsigned_literal_type_node, will be used if available).

> i_t_k[], then we'll get (for example) 20-bit constants, which might
> not be what we want.  The only other option is to special-case
> __int128 if we find it in the __intN list.

Integer constant types should be taken from the int / long / long long 
(and unsigned variants) list.  If a constant can't fit in any type ISO C 
allows for it, then it's reasonable to go on the extended types wider than 
long long, in increasing order of size, but __int20 is never relevant for 
constants as it's always narrower than long.

> Thoughts?

It's desirable anyway to have a way of representing what might be a 
standard type from integer_type_kind, or an extended type, given that it 
would be good for macros such as SIZE_TYPE to evaluate to enumerated 
values not magic strings.  Maybe a reserved space of itk_* values just 
like reserving RID_* values?

> Also, I noted a few tests check for the int128-specific error message
> when the type is not supported, but as per our previous discussion,
> the __int128 keyword just doesn't exist if the type isn't supported.
> Do we need to discern between "not supported with these options" and
> "not supported ever" ?

I don't think there's a need to distinguish, although I don't think it 
would be particularly harmful to have an __int128 keyword present without 
a corresponding type for targets not supporting __int128, if that helps 
diagnostics, as long as nothing else special-cases __int128.

(Draft TS 18661-3 has the interesting peculiarity that the keywords 
_FloatN for N = 16, 32, 64 or >= 128 and a multiple of 32, _DecimalN for N 
>= 32 and a multiple of 32, and _Float32x, _Float64x, _Float128x, 
_Decimal64x, _Decimal128x always exist as keywords whether or not the 
corresponding types are supported.  Implementing that would I suppose 
require special checks to handle arbitrary _FloatN and _DecimalN (for 
valid N) as keywords - an infinite number of keywords - much as we handle 
_Imaginary as a keyword without otherwise implementing it.)

-- 
Joseph S. Myers
joseph@codesourcery.com

  reply	other threads:[~2014-01-09  2:31 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30  4:28 DJ Delorie
2013-10-30 15:53 ` Joseph S. Myers
2013-10-30 19:18   ` DJ Delorie
2013-10-30 20:49     ` Joseph S. Myers
2013-10-30 22:19       ` DJ Delorie
2013-10-30 22:51         ` Joseph S. Myers
2013-11-14  1:58           ` DJ Delorie
2013-11-14 13:26             ` Joseph S. Myers
2013-11-14 18:12               ` DJ Delorie
2013-11-14 18:37                 ` Joseph S. Myers
2013-11-14 18:48                   ` DJ Delorie
2013-11-14 21:40                     ` Joseph S. Myers
2013-11-15  1:47                       ` DJ Delorie
2013-11-15  1:56                         ` Joseph S. Myers
2013-11-15 23:38               ` DJ Delorie
2013-11-16 11:23                 ` Richard Biener
2013-11-16 12:26                   ` Joseph S. Myers
2013-11-21 22:41                     ` DJ Delorie
2013-11-21 22:59                       ` Joseph S. Myers
2013-11-22  8:29                         ` DJ Delorie
2013-11-22 12:43                           ` Joseph S. Myers
2013-11-22 19:33                             ` DJ Delorie
2013-11-22 21:00                               ` Joseph S. Myers
2013-11-22 21:19                                 ` DJ Delorie
2013-11-23  0:41                                   ` Joseph S. Myers
2013-12-10  3:35                                     ` DJ Delorie
2013-12-10 17:17                                       ` Joseph S. Myers
2013-12-10 18:10                                         ` DJ Delorie
2013-12-10 18:38                                           ` Joseph S. Myers
2013-12-10 18:42                                             ` DJ Delorie
2013-12-11  9:27                                               ` Richard Biener
2013-12-20  4:58                                         ` DJ Delorie
2013-12-20 12:42                                           ` Joseph S. Myers
2013-12-20 19:47                                         ` DJ Delorie
2013-12-20 21:53                                           ` Joseph S. Myers
2013-12-20 21:59                                             ` DJ Delorie
2013-12-20 22:15                                               ` Joseph S. Myers
2013-12-20 22:40                                                 ` DJ Delorie
2013-12-21  1:01                                                   ` Joseph S. Myers
2014-01-09  2:31                                                     ` DJ Delorie
2014-01-09  3:23                                                       ` Joseph S. Myers [this message]
2014-01-09  7:02                                                         ` DJ Delorie
2014-01-09 16:22                                                           ` Joseph S. Myers
2014-01-15 12:48                                                             ` DJ Delorie
2014-01-28 21:52                                                               ` DJ Delorie
2014-01-28 21:58                                                                 ` Joseph S. Myers
2014-01-28 22:24                                                                   ` DJ Delorie

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=Pine.LNX.4.64.1401090214160.8625@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=dj@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /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).