Fix ICE.
authorChen Gang <gang.chen.5i5j@gmail.com>
Mon, 29 Sep 2014 16:40:10 +0000 (16:40 +0000)
committerMichael Eager <eager@gcc.gnu.org>
Mon, 29 Sep 2014 16:40:10 +0000 (16:40 +0000)
Fix ICE.  Need use VOID instead of SI, or when real VOIDmode comes, it does not
match SImode, so cause issue.

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

gcc:
* config/microblaze/microblaze.md (call_internal1): Use VOID
instead of SI to fix "((void (*)(void)) 0)()" issue
gcc/testsuite:
* gcc.c-torture/compile/calls-void.c: New test.

From-SVN: r215684

gcc/ChangeLog
gcc/config/microblaze/microblaze.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/calls-void.c [new file with mode: 0644]

index 3c820e9..acc3688 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-29  Chen Gang  <gang.chen.5i5j@gmail.com>
+
+       * config/microblaze/microblaze.md (call_internal1): Use VOID
+       instead of SI to fix "((void (*)(void)) 0)()" issue
+
 2014-09-29  Nick Clifton  <nickc@redhat.com>
 
        * config/msp430/msp430.c (msp430_expand_prologue): Return a
index b971737..3b4faf4 100644 (file)
   (set_attr "length"   "4")])
 
 (define_insn "call_internal1"
-  [(call (mem (match_operand:SI 0 "call_insn_simple_operand" "ri"))
+  [(call (mem (match_operand:VOID 0 "call_insn_simple_operand" "ri"))
         (match_operand:SI 1 "" "i"))
   (clobber (reg:SI R_SR))]
   ""
index 925adf8..9b709f5 100644 (file)
@@ -1,3 +1,7 @@
+2014-09-29  Chen Gang  <gang.chen.5i5j@gmail.com>
+
+       * gcc.c-torture/compile/calls-void.c: New test.
+
 2014-09-29  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/51385
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 (file)
index 0000000..a8dacd7
--- /dev/null
@@ -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)();
+}