diff options
author | Richard Henderson <rth@redhat.com> | 2003-01-20 23:37:13 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2003-01-20 23:37:13 -0800 |
commit | 5b50aa9d606c53248c582235e5a9e5ab6cecbbc4 (patch) | |
tree | 845f9a24a9b8de4f1b5a2639c4606901e650190a /gcc | |
parent | 7a174a15342156271f6c01d9db6314f21b4f2935 (diff) | |
download | gcc-5b50aa9d606c53248c582235e5a9e5ab6cecbbc4.zip gcc-5b50aa9d606c53248c582235e5a9e5ab6cecbbc4.tar.gz gcc-5b50aa9d606c53248c582235e5a9e5ab6cecbbc4.tar.bz2 |
re PR rtl-optimization/7507 (ICE (segfault) with -O2)
PR opt/7507
* stmt.c (expand_asm_operands): Validize memory operands.
* gcc.dg/20030120-1.c: New.
From-SVN: r61535
Diffstat (limited to 'gcc')
-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 122cf2e..78803b7 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. @@ -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 0000000..05689ad --- /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)); +} |