aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/cast-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/cast-4.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cast-4.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cast-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/cast-4.c
new file mode 100644
index 000000000..ebc84c11c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cast-4.c
@@ -0,0 +1,13 @@
+/* Test warnings when casting from a constant integer to pointer.
+ Test with -pedantic-errors. */
+/* Origin: Carlos O'Donell <carlos@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -pedantic-errors" } */
+
+extern int i;
+char c;
+void
+f (void)
+{
+ c = (char)&i; /* { dg-warning "cast from pointer to integer of different size" } */
+}