This is the mail archive of the gcc-patches@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: [Patch, trivial] Fix a potential bug of cost_classes_eq in ira-costs.c


Yes, I see. Thanks for taking this patch. 

Cheers, 
Fei.

> 
> On 12/30/2013, 2:27 AM, Yangfei (Felix) wrote:
> > Add one entry to ChangeLog:
> >
> > Index: gcc/ChangeLog
> >
> ================================================================
> ===
> > --- gcc/ChangeLog       (revision 206236)
> > +++ gcc/ChangeLog       (working copy)
> > @@ -1,3 +1,8 @@
> > +2013-12-30  Felix Yang  <felix.yang@huawei.com>
> > +
> > +       * gcc/ira-costs.c (cost_classes_hasher::equal): memcmp return 0 if
> no
> > +       difference exists for HV1 and HV2.
> > +
> > Index: gcc/ira-costs.c
> >
> ================================================================
> ===
> > --- gcc/ira-costs.c	(revision 206236)
> > +++ gcc/ira-costs.c	(working copy)
> > @@ -155,7 +155,7 @@ inline bool
> >   cost_classes_hasher::equal (const value_type *hv1, const compare_type
> *hv2)
> >   {
> >     return hv1->num == hv2->num && memcmp (hv1->classes,
> hv2->classes,
> > -					 sizeof (enum reg_class) * hv1->num);
> > +					 sizeof (enum reg_class) * hv1->num) == 0;
> >   }
> >
> >   /* Delete cost classes info V from the hash table.  */
> >
> 
> Thanks for finding this typo and pointing this out.  The probability is very small
> that this typo results in different code generation (as a hash is used first for
> accessing hash table) and is zero for wrong code generation.  But it results in
> wasting GCC memory by duplication of the same cover class set in the hash
> table.
> 
> As for the patch.  The changelog entry should have ira-costs.c not
> gcc/ira-costs.c.  Another thing, the line should have less 80 chars.
> 
> I see that you have no write access to GCC repository.  I'll commit the
> modified version of your patch by myself.
> 
> Thanks again, Felix.
> 


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