From 998fd1413977a70cfeb7bf9180f3b462a7731237 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Fri, 9 Mar 2018 18:50:56 +0000 Subject: re PR rtl-optimization/84682 (internal compiler error: Segmentation fault (process_address_1)) PR rtl-optimization/84682 * lra-constraints.c (process_address_1): Check is_address flag for address constraints. (process_alt_operands): Likewise. * lra.c (lra_set_insn_recog_data): Pass asm operand locs to preprocess_constraints. * recog.h (preprocess_constraints): Add oploc parameter. Adjust callers. PR rtl-optimization/84682 * gcc.dg/torture/pr84682-1.c: New. * gcc.dg/torture/pr84682-2.c: New. * gcc.dg/torture/pr84682-3.c: New. From-SVN: r258393 --- gcc/lra-constraints.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'gcc/lra-constraints.c') diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 6bfd465..118b65f 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -2276,6 +2276,12 @@ process_alt_operands (int only_alternative) break; case CT_ADDRESS: + /* An asm operand with an address constraint + that doesn't satisfy address_operand has + is_address cleared, so that we don't try to + make a non-address fit. */ + if (!curr_static_id->operand[nop].is_address) + break; /* If we didn't already win, we can reload the address into a base register. */ if (satisfies_address_constraint_p (op, cn)) @@ -3236,7 +3242,14 @@ process_address_1 (int nop, bool check_only_p, && GET_CODE (XEXP (op, 0)) == SCRATCH) return false; - if (insn_extra_address_constraint (cn)) + if (insn_extra_address_constraint (cn) + /* When we find an asm operand with an address constraint that + doesn't satisfy address_operand to begin with, we clear + is_address, so that we don't try to make a non-address fit. + If the asm statement got this far, it's because other + constraints are available, and we'll use them, disregarding + the unsatisfiable address ones. */ + && curr_static_id->operand[nop].is_address) decompose_lea_address (&ad, curr_id->operand_loc[nop]); /* Do not attempt to decompose arbitrary addresses generated by combine for asm operands with loose constraints, e.g 'X'. */ -- cgit v1.1