This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][GIMPLE-FE] Expose 'sizetype' to the GIMPLE FE
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 15 Aug 2019 13:06:26 +0200 (CEST)
- Subject: [PATCH][GIMPLE-FE] Expose 'sizetype' to the GIMPLE FE
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;