summaryrefslogtreecommitdiff
path: root/gcc/caller-save.c
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-08 15:07:32 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-08 15:07:32 +0000
commit728e6fe86043bb9ad1fbcf27f0acea37d8d661bc (patch)
tree81c730ea6aaf57f2d7811d0525cd96161a9a53ba /gcc/caller-save.c
parentdcc31137f27ace655fa9e8deb27179d7f0e4d560 (diff)
downloadgcc-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/caller-save.c')
-rw-r--r--gcc/caller-save.c14
1 files changed, 9 insertions, 5 deletions
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. */