This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch]: Add support of new __int128 type for targets having 128-bit integer scalar support


On 05/26/2010 11:26 AM, Jason Merrill wrote:
This trick is a bit
ugly but already in use at many places to get an signed type by
__SIZE_TYPE__ macro. As prior version worked on signed integers, I
kept here this.

I think __INTPTR_TYPE__ what you really want in these tests; I'm checking in this patch:


Jason
commit 07a1a441801801787b00c3de0563dffb26e85c1d
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Jun 30 00:37:57 2010 -0400

    	* g++.dg/cpp0x/nullptr04.C: Use __INTPTR_TYPE__.
    	* g++.dg/other/pr25632.C: Likewise.

diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr04.C b/gcc/testsuite/g++.dg/cpp0x/nullptr04.C
index 6e1d125..be581bc 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr04.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr04.C
@@ -3,17 +3,15 @@
 
 // Test cast to int
 
-#define unsigned
-__extension__ typedef __SIZE_TYPE__ ssize_t;
-#undef unsigned
+__extension__ typedef __INTPTR_TYPE__ intptr_t;
 
 const int n4 = static_cast<const int>(nullptr); // { dg-error "invalid static_cast " }
 const short int n5 = reinterpret_cast<short int>(nullptr); // { dg-error "loses precision" }
-const ssize_t n6 = reinterpret_cast<ssize_t>(nullptr);
-const ssize_t n7 = (ssize_t)nullptr;
+const intptr_t n6 = reinterpret_cast<intptr_t>(nullptr);
+const intptr_t n7 = (intptr_t)nullptr;
 
 decltype(nullptr) mynull = 0;
 const int n8 = static_cast<const int>(mynull); // { dg-error "invalid static_cast " }
 const short int n9 = reinterpret_cast<short int>(mynull); // { dg-error "loses precision" }
-const ssize_t n10 = reinterpret_cast<ssize_t>(mynull);
-const ssize_t n11 = (ssize_t)mynull;
+const intptr_t n10 = reinterpret_cast<intptr_t>(mynull);
+const intptr_t n11 = (intptr_t)mynull;
diff --git a/gcc/testsuite/g++.dg/other/pr25632.C b/gcc/testsuite/g++.dg/other/pr25632.C
index fe0ad7a..e66ae3b 100644
--- a/gcc/testsuite/g++.dg/other/pr25632.C
+++ b/gcc/testsuite/g++.dg/other/pr25632.C
@@ -2,14 +2,12 @@
 
 /* { dg-do compile } */
 
-#define unsigned
-__extension__ typedef __SIZE_TYPE__ ssize_t;
-#undef unsigned
+__extension__ typedef __INTPTR_TYPE__ intptr_t;
 
 struct sockaddr_un {
     char sun_path[1];
 };
-const unsigned SI_SUN_HEAD_LEN = (ssize_t)(((struct sockaddr_un *)0)->sun_path);
+const unsigned SI_SUN_HEAD_LEN = (intptr_t)(((struct sockaddr_un *)0)->sun_path);
 int SiGetPeerName ()
 {
     return SI_SUN_HEAD_LEN;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]