public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][GIMPLE-FE] Expose 'sizetype' to the GIMPLE FE
@ 2019-08-15 11:11 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2019-08-15 11:11 UTC (permalink / raw)
  To: gcc-patches


This exposes 'sizetype' as __SIZETYPE__ to help writing "portable"
GIMPLE testcases.

Will commit soonish, more testcases might need adjustment
for some targets.

Richard.

2019-08-15  Richard Biener  <rguenther@suse.de>

	c-family/
	* c-common.c (c_stddef_cpp_builtins): When the GIMPLE FE is
	enabled, define __SIZETYPE__.

	* gcc.dg/pr80170.c: Adjust.

Index: gcc/c-family/c-common.c
===================================================================
--- gcc/c-family/c-common.c	(revision 274504)
+++ gcc/c-family/c-common.c	(working copy)
@@ -5148,6 +5148,10 @@ c_stddef_cpp_builtins(void)
     builtin_define_with_value ("__INTPTR_TYPE__", INTPTR_TYPE, 0);
   if (UINTPTR_TYPE)
     builtin_define_with_value ("__UINTPTR_TYPE__", UINTPTR_TYPE, 0);
+  /* GIMPLE FE testcases need access to the GCC internal 'sizetype'.
+     Expose it as __SIZETYPE__.  */
+  if (flag_gimple)
+    builtin_define_with_value ("__SIZETYPE__", SIZETYPE, 0);
 }
 
 static void
Index: gcc/testsuite/gcc.dg/pr80170.c
===================================================================
--- gcc/testsuite/gcc.dg/pr80170.c	(revision 274504)
+++ gcc/testsuite/gcc.dg/pr80170.c	(working copy)
@@ -24,11 +24,7 @@ NullB (void * misalignedPtr)
   struct B * b;
 
   bb_2:
-#if __SIZEOF_LONG__ == 8
-  b_2 = misalignedPtr_1(D) + 18446744073709551608ul;
-#else
-  b_2 = misalignedPtr_1(D) + 4294967292ul;
-#endif
+  b_2 = misalignedPtr_1(D) + _Literal (__SIZETYPE__) -__SIZEOF_POINTER__;
   __MEM <struct B> (b_2).a.a = _Literal (void *) 0;
   __MEM <struct B> (b_2).a.b = _Literal (void *) 0;
   return;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-15 11:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-15 11:11 [PATCH][GIMPLE-FE] Expose 'sizetype' to the GIMPLE FE Richard Biener

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).