This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR target/21299 (reload accepting invalid asm)

Jan Hubicka <> writes:

> the testcase in PR specify destination for DImode register as "ab" instead of
> "A".

This is user error.  Obviously we shouldn't ICE, but we don't have to
handle it reasonably. 

> This hits difference in between reload and recog understanding of class
> specifier - while recog is testing each letter separately and thus DImode
> register won't fit to 'a' nor 'b' class, reload is always doing subunion of
> alternatives before verifying, so it actually converts "ab" into "A" and is
> satisfied.

I believe that both reload and recog are acting reasonably.  If you
specify more than register class in a constraint, then the register
must fit one of those constraints.  And, because the backend writer is
supposed to define a register class for the union of all register
classes which can appear together, then it is OK to use the short-cut
of simply requiring the register to belong to that union class.

In this case the user specified two register classes, neither of which
can hold a DImode value.  That is an error.  That error should never
occur in an MD file.  The only issue here is how to best handle this
error without ICEing.

I think the simplest way is likely to be in reload in the final pass
over the insns.  Do something like this:

  /* Clean up invalid ASMs so that they don't confuse later passes.
     See PR 21299.  */
  if (asm_noperands (PATTERN (insn)) >= 0)
      extract_insn (insn);
      if (!constrain_operands (1))
          error_for_asm (insn, "%<asm%> operand has impossible constraints");
          delete_insn (insn);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]