This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, trivial] Fix a potential bug of cost_classes_eq in ira-costs.c
- From: "Yangfei (Felix)" <felix dot yang at huawei dot com>
- To: Vladimir Makarov <vmakarov at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 31 Dec 2013 01:31:23 +0000
- Subject: Re: [Patch, trivial] Fix a potential bug of cost_classes_eq in ira-costs.c
- Authentication-results: sourceware.org; auth=none
- References: <DA41BE1DDCA941489001C7FBD7A8820E54A33585 at szxema507-mbx dot china dot huawei dot com> <52C198C2 dot 9000703 at redhat dot com>
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.
>