public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Andreas Schwab <schwab@suse.de>
Cc: Jason Merrill <jason@redhat.com>,
	       gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: C++ PATCH to add __integer_pack built-in for std::make_integer_sequence (c++/80396)
Date: Wed, 24 May 2017 15:17:00 -0000	[thread overview]
Message-ID: <20170524150823.GK8499@tucnak> (raw)
In-Reply-To: <mvmefvewda9.fsf@suse.de>

On Wed, May 24, 2017 at 04:16:30PM +0200, Andreas Schwab wrote:
> FAIL: g++.dg/ext/integer-pack2.C  -std=gnu++11 (test for excess errors)
> Excess errors:
> /daten/aranym/gcc/gcc-20170524/gcc/testsuite/g++.dg/ext/integer-pack2.C:10:48: error: overflow in constant expression [-fpermissive]
> /daten/aranym/gcc/gcc-20170524/gcc/testsuite/g++.dg/ext/integer-pack2.C:10:48: error: overflow in constant expression [-fpermissive]

To be precise, it fails only on 32-bit targets.

If we at that point want some wider integer that when cast to int
is 0 (or small enough positive number?), shall we use something like
this, or say 1LL << (sizeof (int) * __CHAR_BIT__), or 2LL * INT_MIN,
something else?  Do we need to include <limits.h>?  Or can we replace
INT_MAX with __INT_MAX__?
Not sure about that -2147483650 for 16-bit int targets (perhaps the test can
be guarded with int32 effective target).

2017-05-24  Jakub Jelinek  <jakub@redhat.com>

	* g++.dg/ext/integer-pack2.C (w): Use -9223372036854775807LL - 1
	instead of -9223372036854775808.

--- gcc/testsuite/g++.dg/ext/integer-pack2.C.jj	2017-05-24 11:59:01.000000000 +0200
+++ gcc/testsuite/g++.dg/ext/integer-pack2.C	2017-05-24 16:24:18.341421124 +0200
@@ -7,6 +7,6 @@ template<typename T, T...> struct intege
 template<typename T, T num>
  using make_integer_sequence = integer_sequence<T, __integer_pack(num)...>; // { dg-error "argument" }
 
-make_integer_sequence<int, -9223372036854775808> w;
+make_integer_sequence<int, -9223372036854775807LL - 1> w;
 make_integer_sequence<int, INT_MAX> x;	   // { dg-message "required" }
 make_integer_sequence<int, -2147483650> y; // { dg-message "required" }


	Jakub

  reply	other threads:[~2017-05-24 15:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23 20:27 Jason Merrill
2017-05-24 14:18 ` Andreas Schwab
2017-05-24 15:17   ` Jakub Jelinek [this message]
2017-05-24 18:50     ` Jason Merrill
2017-05-24 19:13       ` Jakub Jelinek

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=20170524150823.GK8499@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=schwab@suse.de \
    /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).