diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/caller-save.c | 14 |
2 files changed, 14 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 963cfe0f789..bd2529cda77 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2010-11-08 Joern Rennecke <amylaar@spamcop.net> + + * caller-save.c (reg_save_code): After HARD_REGNO_MODE_OK check fails, + assert that REG is a hard register number before using it as an index. + 2010-11-08 Eric Botcazou <ebotcazou@adacore.com> PR target/46208 diff --git a/gcc/caller-save.c b/gcc/caller-save.c index 9ca8592bf34..e10681ce527 100644 --- a/gcc/caller-save.c +++ b/gcc/caller-save.c @@ -116,11 +116,15 @@ reg_save_code (int reg, enum machine_mode mode) if (cached_reg_save_code[reg][mode]) return cached_reg_save_code[reg][mode]; if (!HARD_REGNO_MODE_OK (reg, mode)) - { - cached_reg_save_code[reg][mode] = -1; - cached_reg_restore_code[reg][mode] = -1; - return -1; - } + { + /* Depending on how HARD_REGNO_MODE_OK is defined, range propagation + might deduce here that reg >= FIRST_PSEUDO_REGISTER. So the assert + below silences a warning. */ + gcc_assert (reg < FIRST_PSEUDO_REGISTER); + cached_reg_save_code[reg][mode] = -1; + cached_reg_restore_code[reg][mode] = -1; + return -1; + } /* Update the register number and modes of the register and memory operand. */ |