diff options
author | wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-05-04 19:16:35 +0000 |
---|---|---|
committer | wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-05-04 19:16:35 +0000 |
commit | 981ac4252fe330b84d4feda86fea316cece75ff8 (patch) | |
tree | f0914b034e218ac7b59f25135a52b9429d5e9eea /gcc/expr.c | |
parent | 512a87eabb9ae1a78048e886254abfd32640c75c (diff) | |
download | gcc-981ac4252fe330b84d4feda86fea316cece75ff8.tar.gz |
Fix bug where storing into const string gives core dump, from Kamil Iskra.
* expr.c (expand_expr, case INDIRECT_REF): Don't optimize string
reference if this is a store.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19531 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c index c094a0f0f02..8b8e5133b6a 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -5484,13 +5484,15 @@ expand_expr (exp, target, tmode, modifier) tree string = string_constant (exp1, &index); int i; + /* Try to optimize reads from const strings. */ if (string && TREE_CODE (string) == STRING_CST && TREE_CODE (index) == INTEGER_CST && !TREE_INT_CST_HIGH (index) && (i = TREE_INT_CST_LOW (index)) < TREE_STRING_LENGTH (string) && GET_MODE_CLASS (mode) == MODE_INT - && GET_MODE_SIZE (mode) == 1) + && GET_MODE_SIZE (mode) == 1 + && modifier != EXPAND_MEMORY_USE_WO) return GEN_INT (TREE_STRING_POINTER (string)[i]); op0 = expand_expr (exp1, NULL_RTX, VOIDmode, EXPAND_SUM); |