Patch fixing a typo.

H.J. Lu hjl.tools@gmail.com
Sat Apr 25 01:21:00 GMT 2009


On Fri, Apr 24, 2009 at 5:36 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Apr 22, 2009 at 1:22 PM, Vladimir Makarov <vmakarov@redhat.com> wrote:
>> I've made a mistake when prepared a big patch in Dec (this patch without
>> #ifdef was successfully tested on m32c.  #ifdef and #endif were added a bit
>> lately and the final patch was bootstrapped and tested on x86/x86_64).  Ian
>> recently found this typo
>>
>> http://gcc.gnu.org/ml/gcc/2009-04/msg00544.html
>>
>> The typo was not a serious one.  It could have resulted in worse code for
>> most targets when -fira-algorithm=priority is used (it is not a default for
>> all architectures except for m32c).  Although it might have created problems
>> for m32c (a weird architecture which uses priority coloring by default).
>>
>> Here is the fix
>>
>> 2009-04-22  Vladimir Makarov  <vmakarov@redhat.com>
>>
>>   * genpreds.c (write_enum_constraint_num): Output definition of
>>   CONSTRAINT_NUM_DEFINED_P macro.
>>   * ira.c (setup_cover_and_important_classes): Use
>>   CONSTRAINT_NUM_DEFINED_P instead of CONSTRAINT__LIMIT in #ifdef.
>>
>> The patch was successfully bootstrapped on x86_64.  I hope it will also fix
>> a m32c failure reported by DJ recently.
>>
>> Is it ok to commit?
>>
>>
>> Index: genpreds.c
>> ===================================================================
>> --- genpreds.c  (revision 146528)
>> +++ genpreds.c  (working copy)
>> @@ -954,6 +954,7 @@ write_enum_constraint_num (void)
>>  {
>>   struct constraint_data *c;
>>
>> +  fputs ("#define CONSTRAINT_NUM_DEFINED_P 1\n", stdout);
>>   fputs ("enum constraint_num\n"
>>         "{\n"
>>         "  CONSTRAINT__UNKNOWN = 0", stdout);
>> Index: ira.c
>> ===================================================================
>> --- ira.c       (revision 146528)
>> +++ ira.c       (working copy)
>> @@ -754,9 +754,9 @@ setup_cover_and_important_classes (void)
>>        {
>>          if (i == NO_REGS)
>>            continue;
>> -#ifdef CONSTRAINT__LIMIT
>> +#ifdef CONSTRAINT_NUM_DEFINED_P
>>          for (j = 0; j < CONSTRAINT__LIMIT; j++)
>> -           if ((int) regclass_for_constraint (j) == i)
>> +           if ((int) regclass_for_constraint ((enum constraint_num) j) ==
>> i)
>>              break;
>>          if (j < CONSTRAINT__LIMIT)
>>            {
>>
>
> It breaks gcc:
>
> cc1: warnings being treated as errors
> ../../src-trunk/gcc/ira.c: In function 'setup_cover_and_important_classes':
> ../../src-trunk/gcc/ira.c:763: error: enum conversion in assignment is
> invalid in C++
> make[6]: *** [ira.o] Error 1
>

I am checking it in as an obvious fix.


H.J.
Index: ira.c
===================================================================
--- ira.c	(revision 146749)
+++ ira.c	(working copy)
@@ -760,7 +760,7 @@ setup_cover_and_important_classes (void)
 	      break;
 	  if (j < CONSTRAINT__LIMIT)
 	    {
-	      classes[n++] = i;
+	      classes[n++] = (enum reg_class) i;
 	      continue;
 	    }
 #endif



More information about the Gcc-patches mailing list