diff options
| author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-01-21 07:37:13 +0000 |
|---|---|---|
| committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-01-21 07:37:13 +0000 |
| commit | 154ffe7ed1bec29dbee756a03d57046ed0cccfe9 (patch) | |
| tree | 845f9a24a9b8de4f1b5a2639c4606901e650190a | |
| parent | 1a682a4cd968c922145ab5cdb91a06670c51a191 (diff) | |
| download | ppe42-gcc-154ffe7ed1bec29dbee756a03d57046ed0cccfe9.tar.gz ppe42-gcc-154ffe7ed1bec29dbee756a03d57046ed0cccfe9.zip | |
PR opt/7507
* stmt.c (expand_asm_operands): Validize memory operands.
* gcc.dg/20030120-1.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@61535 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/stmt.c | 32 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/20030120-1.c | 10 |
3 files changed, 36 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 122cf2e037e..78803b74e24 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2003-01-20 Richard Henderson <rth@redhat.com> + PR opt/7507 + * stmt.c (expand_asm_operands): Validize memory operands. + +2003-01-20 Richard Henderson <rth@redhat.com> + PR opt/8848 * ifcvt.c (noce_process_if_block): Correct arguments to modified_between_p for no-else-block case. diff --git a/gcc/stmt.c b/gcc/stmt.c index 6f122c4d31b..b6503cfa9ca 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -1610,6 +1610,7 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) bool is_inout; bool allows_reg; bool allows_mem; + rtx op; if (!parse_output_constraint (&constraints[i], i, ninputs, noutputs, &allows_mem, &allows_reg, @@ -1633,24 +1634,28 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) || ! allows_reg || is_inout) { - output_rtx[i] = expand_expr (val, NULL_RTX, VOIDmode, EXPAND_WRITE); + op = expand_expr (val, NULL_RTX, VOIDmode, EXPAND_WRITE); + if (GET_CODE (op) == MEM) + op = validize_mem (op); - if (! allows_reg && GET_CODE (output_rtx[i]) != MEM) + if (! allows_reg && GET_CODE (op) != MEM) error ("output number %d not directly addressable", i); - if ((! allows_mem && GET_CODE (output_rtx[i]) == MEM) - || GET_CODE (output_rtx[i]) == CONCAT) + if ((! allows_mem && GET_CODE (op) == MEM) + || GET_CODE (op) == CONCAT) { - real_output_rtx[i] = protect_from_queue (output_rtx[i], 1); - output_rtx[i] = gen_reg_rtx (GET_MODE (output_rtx[i])); + real_output_rtx[i] = protect_from_queue (op, 1); + op = gen_reg_rtx (GET_MODE (op)); if (is_inout) - emit_move_insn (output_rtx[i], real_output_rtx[i]); + emit_move_insn (op, real_output_rtx[i]); } } else { - output_rtx[i] = assign_temp (type, 0, 0, 1); - TREE_VALUE (tail) = make_tree (type, output_rtx[i]); + op = assign_temp (type, 0, 0, 1); + op = validize_mem (op); + TREE_VALUE (tail) = make_tree (type, op); } + output_rtx[i] = op; generating_concat_p = old_generating_concat_p; @@ -1702,6 +1707,8 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) /* Never pass a CONCAT to an ASM. */ if (GET_CODE (op) == CONCAT) op = force_reg (GET_MODE (op), op); + else if (GET_CODE (op) == MEM) + op = validize_mem (op); if (asm_operand_ok (op, constraint) <= 0) { @@ -1711,7 +1718,10 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) warning ("asm operand %d probably doesn't match constraints", i + noutputs); else if (CONSTANT_P (op)) - op = force_const_mem (TYPE_MODE (type), op); + { + op = force_const_mem (TYPE_MODE (type), op); + op = validize_mem (op); + } else if (GET_CODE (op) == REG || GET_CODE (op) == SUBREG || GET_CODE (op) == ADDRESSOF @@ -1721,7 +1731,7 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) (TYPE_QUALS (type) | TYPE_QUAL_CONST)); rtx memloc = assign_temp (qual_type, 1, 1, 1); - + memloc = validize_mem (memloc); emit_move_insn (memloc, op); op = memloc; } diff --git a/gcc/testsuite/gcc.dg/20030120-1.c b/gcc/testsuite/gcc.dg/20030120-1.c new file mode 100644 index 00000000000..05689ad0961 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20030120-1.c @@ -0,0 +1,10 @@ +/* PR 7154 */ +/* { dg-do compile } */ +/* { dg-options "-O -fpic" } */ +/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* mmix-*-* } 0 } */ + +const int x[1]={ 1 }; +void foo(int i, int *p) +{ + asm volatile("" : "+r"(i) : "m" (x[0]), "r"(p)); +} |

