[PATCH] Add test case for "((void (*)(void)) 0)()"

Chen Gang gang.chen.5i5j@gmail.com
Sun Sep 28 14:52:00 GMT 2014


For the original microblaze, it will report error with "-O0" (and other
flags are all OK).

gcc/testsuite/:

2014-09-28  Chen Gang  <gang.chen.5i5j@gmail.com>

	* gcc.c-torture/compile/calls-void.c: New test.

---
 gcc/testsuite/gcc.c-torture/compile/calls-void.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 gcc/testsuite/gcc.c-torture/compile/calls-void.c

diff --git a/gcc/testsuite/gcc.c-torture/compile/calls-void.c b/gcc/testsuite/gcc.c-torture/compile/calls-void.c
new file mode 100644
index 0000000..a8dacd7
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/calls-void.c
@@ -0,0 +1,23 @@
+/* { dg-require-effective-target ptr32plus } */
+typedef void  (*T)(void);
+f1 ()
+{
+  ((T) 0)();
+}
+f2 ()
+{
+  ((T) 1000)();
+}
+f3 ()
+{
+  ((T) 10000000)();
+}
+f4 (r)
+{
+  ((T) r)();
+}
+f5 ()
+{
+  int (*r)() = f3;
+  ((T) r)();
+}
-- 
1.9.3



More information about the Gcc-patches mailing list