From 7d21a61eb5c0a7d12fa4b2bf2dfcb5ca7398a5bb Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Sat, 30 May 2015 02:05:54 -0400 Subject: [PATCH] expmed.c (extract_bit_field_1): Avoid clobbering a yet-to-be-used base/index register. * expmed.c (extract_bit_field_1): Avoid clobbering a yet-to-be-used base/index register. From-SVN: r223885 --- gcc/ChangeLog | 5 +++++ gcc/expmed.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 76992ee4a75..2f3fcaef242 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-05-28 DJ Delorie + + * expmed.c (extract_bit_field_1): Avoid clobbering a + yet-to-be-used base/index register. + 2015-05-30 Jan Hubicka * alias.c (alias_set_entry_d): Add is_pointer and has_pointer. diff --git a/gcc/expmed.c b/gcc/expmed.c index fa13f8ced3f..4b2b02659e7 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -1616,6 +1616,11 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize, if (target == 0 || !REG_P (target) || !valid_multiword_target_p (target)) target = gen_reg_rtx (mode); + /* In case we're about to clobber a base register or something + (see gcc.c-torture/execute/20040625-1.c). */ + if (reg_mentioned_p (target, str_rtx)) + target = gen_reg_rtx (mode); + /* Indicate for flow that the entire target reg is being set. */ emit_clobber (target); -- 2.30.2