diff options
author | Richard Stallman <rms@gnu.org> | 1992-09-21 06:46:22 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-09-21 06:46:22 +0000 |
commit | 2baccce2f7497923aa1a9bcf2e6c90e0a3e74992 (patch) | |
tree | 6de19a0d0b3dc4a9d41920da7a65d62b315d4781 /gcc | |
parent | 13c9910fdd0e05248c4a8803dbf4e256bb386c1c (diff) | |
download | gcc-2baccce2f7497923aa1a9bcf2e6c90e0a3e74992.zip gcc-2baccce2f7497923aa1a9bcf2e6c90e0a3e74992.tar.gz gcc-2baccce2f7497923aa1a9bcf2e6c90e0a3e74992.tar.bz2 |
(put_var_into_stack): Check REG != 0 before dereference.
From-SVN: r2198
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/function.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/function.c b/gcc/function.c index 9295cb1..a7e1438 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -818,11 +818,18 @@ put_var_into_stack (decl) /* Get the current rtl used for this object and it's original mode. */ reg = TREE_CODE (decl) == SAVE_EXPR ? SAVE_EXPR_RTL (decl) : DECL_RTL (decl); - promoted_mode = GET_MODE (reg); + + /* No need to do anything if decl has no rtx yet + since in that case caller is setting TREE_ADDRESSABLE + and a stack slot will be assigned when the rtl is made. */ + if (reg == 0) + return; /* Get the declared mode for this object. */ decl_mode = (TREE_CODE (decl) == SAVE_EXPR ? TYPE_MODE (TREE_TYPE (decl)) : DECL_MODE (decl)); + /* Get the mode it's actually stored in. */ + promoted_mode = GET_MODE (reg); /* If this variable comes from an outer function, find that function's saved context. */ @@ -831,12 +838,6 @@ put_var_into_stack (decl) if (function->decl == context) break; - /* No need to do anything if decl has no rtx yet - since in that case caller is setting TREE_ADDRESSABLE - and a stack slot will be assigned when the rtl is made. */ - if (reg == 0) - return; - /* If this is a variable-size object with a pseudo to address it, put that pseudo into the stack, if the var is nonlocal. */ if (DECL_NONLOCAL (decl) |