This is the mail archive of the gcc@gcc.gnu.org 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: genrecog: match_code "bug"?


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


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