This is the mail archive of the
mailing list for the GCC project.
Re: PR target/21299 (reload accepting invalid asm)
- From: Ian Lance Taylor <iant at google dot com>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 09 Aug 2006 08:18:58 -0700
- Subject: Re: PR target/21299 (reload accepting invalid asm)
- References: <20060808131508.GE3150@kam.mff.cuni.cz>
Jan Hubicka <email@example.com> writes:
> the testcase in PR specify destination for DImode register as "ab" instead of
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
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)
if (!constrain_operands (1))
error_for_asm (insn, "%<asm%> operand has impossible constraints");