diff options
author | amylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-08 15:07:32 +0000 |
---|---|---|
committer | amylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-08 15:07:32 +0000 |
commit | 728e6fe86043bb9ad1fbcf27f0acea37d8d661bc (patch) | |
tree | 81c730ea6aaf57f2d7811d0525cd96161a9a53ba /gcc | |
parent | dcc31137f27ace655fa9e8deb27179d7f0e4d560 (diff) | |
download | gcc-728e6fe86043bb9ad1fbcf27f0acea37d8d661bc.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166434 138bc75d-0d04-0410-961f-82ee72b054a4
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. */ |