mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-11 06:44:31 +08:00
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
This commit is contained in:
parent
7a174a1534
commit
5b50aa9d60
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
32
gcc/stmt.c
32
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;
|
||||
}
|
||||
|
10
gcc/testsuite/gcc.dg/20030120-1.c
Normal file
10
gcc/testsuite/gcc.dg/20030120-1.c
Normal file
@ -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));
|
||||
}
|
Loading…
Reference in New Issue
Block a user