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]

genrecog: match_code "bug"?


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.


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