On 03/08/2018 11:45 PM, Alexandre Oliva wrote: > LRA gets very confused when non-addresses are passed as operands to > asms with address contraints. Even if other constraints are > available, and the operand is a perfect fit for them, we'd still > attempt to process the operand as an address, and fail miserably at > that. > > Truth is, address constraints expect operands allowed by > address_operand, and we make sure this is the case throughout the > compiler, even in asm statements. The problem was that, if multiple > constraints were available, we wouldn't insist that the operand be > allowed by address_operand, but we would proceed as if it was, > regardless of any other constraints. > > To address this problem, I've arranged for LRA to attempt to deal with > address-constrained operands as addresses only when the is_address > flag is set, and to not set this flag in preprocess_constraints for > asm operands that are not allowed by address_operand. > > Regstrapped on i686- and x86_64-linux-gnu. Ok to install? > > for gcc/ChangeLog > > 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. > * recog.c (preprocess_constraints): Test address_operand for > CT_ADDRESS constraints. > > for gcc/testsuite/ChangeLog > > 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. I went ahead and committed this to the trunk.
jeff