This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: genrecog: match_code "bug"?
- From: Zack Weinberg <zack at codesourcery dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 17 Dec 2004 17:11:34 -0800
- Subject: Re: genrecog: match_code "bug"?
- References: <200412180023.iBI0NjQm012464@greed.delorie.com>
DJ Delorie <dj@redhat.com> writes:
> In genrecog.c:compute_predicates_code, we use this code
> for the MATCH_CODE case:
>
> for (i = 0; i < NUM_RTX_CODE; i++)
> if (!strncmp (code, GET_RTX_NAME (i), n)
> && GET_RTX_NAME (i)[n] == '\0')
> {
> codes[i] = Y;
> break;
> }
>
> This code is case sensitive, yet produces no warnings when codes don't
> match any known codes. This just burned me, because I used upper case
> codes instead of lower case (hey, that's what the C sources have to
> use, right?) and nothing matched, causing weird recog failures.
>
> So, what to do?
>
> 1. Be case insensitive (we can use strncasecmp as it's in libiberty)
>
> 2. Warn when a code isn't matched.
>
> 3. Both.
I have a mild preference for not doing 1, on the grounds that
everywhere else in machine descriptions (except for embedded blocks of
C) you have to use lower case; and I think that whether or not we do 1
we should definitely do 2.
zw