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 <[email protected]>
+
+ * 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. */
Cheers,
Fei.
>
> Ping.
>
> Attached please find patch is for trunk (gcc-4.9):
>
> 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. */
>
> Cheers,
> Fei.
>
>
> > Hi Vladimir,
> >
> > I am trying to fix a potential bug of cost_classes_eq in
> > ira-costs.c. This patch is for gcc-4.8 branch and should work for gcc-4.9.
> > Library function memcmp return 0 if no difference for the two compared
> data.
> > Please take a look.
> >
> >
> > /* Compares cost classes info V1 and V2. */ static int
> > cost_classes_eq (const void *v1, const void *v2) {
> > const_cost_classes_t hv1 = (const_cost_classes_t) v1;
> > const_cost_classes_t hv2 = (const_cost_classes_t) v2;
> >
> > return hv1->num == hv2->num && memcmp (hv1->classes, hv2->classes,
> > - sizeof (enum reg_class) * hv1->num);
> > + sizeof (enum reg_class) * hv1->num) ==
> > 0;
> > }
> >
> > Cheers,
> > Fei