aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/cast-ptr-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/cast-ptr-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/cast-ptr-1.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/cast-ptr-1.c b/gcc/testsuite/gcc.dg/cast-ptr-1.c
new file mode 100644
index 00000000000..cb42d13ac48
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cast-ptr-1.c
@@ -0,0 +1,15 @@
+/* APPLE LOCAL file pointer casts */
+/* Test that casts of pointer to unsigned long long aren't sign extended */
+/* Author: Matt Austern <austern@apple.com> */
+/* { dg-do run } */
+/* { dg-options "-Wno-error -w" } */
+
+int main () {
+ /* Note: test assumes sizeof(long long) >= sizeof(void*) */
+
+ unsigned long x1 = 0x80000000ul;
+ void* p = (void*) x1;
+ unsigned long long x2 = (unsigned long long) p;
+
+ return !(x1 == x2);
+}