genrecog: match_code "bug"?

DJ Delorie dj@redhat.com
Sat Dec 18 00:24:00 GMT 2004


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.



More information about the Gcc mailing list