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

Michael Eager eager@eagerm.com
Sat Sep 27 13:42:00 GMT 2014


On 09/25/14 07:03, Chen Gang wrote:
> 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
> testsuite.
>
> 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
>     f1
>    Analyzing compilation unit
>    Performing interprocedural optimizations
>     <*free_lang_data> <visibility> <early_local_cleanups> <free-inline-summary> <whole-program> <inline>Assembling functions:
>     f1
>    /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
>         (nil)
>        (nil))
>    /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*)
>    	../../gcc/gcc/rtl-error.c:109
>    0xb0e75c _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
>    	../../gcc/gcc/rtl-error.c:117
>    0xac552b extract_insn(rtx_def*)
>    	../../gcc/gcc/recog.c:2204
>    0x8b919e instantiate_virtual_regs_in_insn
>    	../../gcc/gcc/function.c:1614
>    0x8ba347 instantiate_virtual_regs
>    	../../gcc/gcc/function.c:1934
>    0x8ba452 execute
>    	../../gcc/gcc/function.c:1983
>    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.

Is this test case (or a similar one) in the gcc test suite?

If not, can you please add it to the test suite.

>
>
> 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))]
>     ""

I've verified that your patch does not cause any test suite regressions.


-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077



More information about the Gcc-patches mailing list