diff options
author | Renlin Li <renlin.li@arm.com> | 2016-08-09 17:20:14 +0000 |
---|---|---|
committer | Renlin Li <renlin@gcc.gnu.org> | 2016-08-09 17:20:14 +0000 |
commit | 408702b44570a4c92e4f9d05cd97f98cf12a4eb4 (patch) | |
tree | cf4bf4eff74b4d63228faeb3496ff8880b11304d /gcc/calls.c | |
parent | d676d623eb1e2aabcb2d3c10574a1c240083a22a (diff) | |
download | gcc-408702b44570a4c92e4f9d05cd97f98cf12a4eb4.zip gcc-408702b44570a4c92e4f9d05cd97f98cf12a4eb4.tar.gz gcc-408702b44570a4c92e4f9d05cd97f98cf12a4eb4.tar.bz2 |
[PATCH][PR64971]Convert function pointer to Pmode when emit call.
gcc/
2016-08-04 Renlin Li <renlin.li@arm.com>
PR middle-end/64971
* calls.c (prepare_call_address): Convert funexp to Pmode when
necessary.
* config/aarch64/aarch64.md (sibcall): Remove fix for PR 64971.
(sibcall_value): Likewise.
From-SVN: r239300
Diffstat (limited to 'gcc/calls.c')
-rw-r--r-- | gcc/calls.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/calls.c b/gcc/calls.c index 949a92e..4ad3e34 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -194,10 +194,19 @@ prepare_call_address (tree fndecl_or_type, rtx funexp, rtx static_chain_value, && targetm.small_register_classes_for_mode_p (FUNCTION_MODE)) ? force_not_mem (memory_address (FUNCTION_MODE, funexp)) : memory_address (FUNCTION_MODE, funexp)); - else if (! sibcallp) + else { - if (!NO_FUNCTION_CSE && optimize && ! flag_no_function_cse) - funexp = force_reg (Pmode, funexp); + /* funexp could be a SYMBOL_REF represents a function pointer which is + of ptr_mode. In this case, it should be converted into address mode + to be a valid address for memory rtx pattern. See PR 64971. */ + if (GET_MODE (funexp) != Pmode) + funexp = convert_memory_address (Pmode, funexp); + + if (! sibcallp) + { + if (!NO_FUNCTION_CSE && optimize && ! flag_no_function_cse) + funexp = force_reg (Pmode, funexp); + } } if (static_chain_value != 0 |