[PATCH] microblaze: microblaze.md: Use VOID instead of SI to fix "((void (*)(void)) 0)()" issue

Chen Gang gang.chen.5i5j@gmail.com
Thu Sep 25 14:03:00 GMT 2014

Need use VOID instead of SI, or when real VOIDmode comes, it does not
match SImode, so cause issue. This patch can fix this issue and pass

The related test code ('void' will cause CALL instead of SET):

  typedef void (*T)(void);
  f1 ()
    ((T) 0)();

The related error:

  [root@localhost gcc]# ./cc1 /tmp/calls.c -o /tmp/1.s
  Analyzing compilation unit
  Performing interprocedural optimizations
   <*free_lang_data> <visibility> <early_local_cleanups> <free-inline-summary> <whole-program> <inline>Assembling functions:
  /tmp/calls.c: In function 'f1':
  /tmp/calls.c:5:1: error: unrecognizable insn:
  (call_insn 5 2 8 2 (parallel [
              (call (mem:SI (const_int 0 [0]) [0 MEM[(void (*<T29c>) (void))0B] S4 A32])
                  (const_int 24 [0x18]))
              (clobber (reg:SI 15 r15))
          ]) /tmp/calls.c:4 -1
  /tmp/calls.c:5:1: internal compiler error: in extract_insn, at recog.c:2204
  0xb0e71b _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
  0xb0e75c _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
  0xac552b extract_insn(rtx_def*)
  0x8b919e instantiate_virtual_regs_in_insn
  0x8ba347 instantiate_virtual_regs
  0x8ba452 execute
  Please submit a full bug report,
  with preprocessed source if appropriate.
  Please include the complete backtrace with any bug report.
  See <http://gcc.gnu.org/bugs.html> for instructions.

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

	* config/microblaze/microblaze.md (call_internal1): Use VOID
	instead of SI to fix "((void (*)(void)) 0)()" issue

 gcc/config/microblaze/microblaze.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
index b971737..3b4faf4 100644
--- a/gcc/config/microblaze/microblaze.md
+++ b/gcc/config/microblaze/microblaze.md
@@ -2062,7 +2062,7 @@
   (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))]

More information about the Gcc-patches mailing list