On Fri, Jun 27, 2014 at 9:16 AM, Jakub Jelinek <ja...@redhat.com> wrote:
> Hi!
>
> This fixes the most common source of the new runtime diagnostics
> during bootstrap-ubsan, if num is 0, ira_object_id_map is often
> 0 as well.
>
> Ok for trunk/4.9?

If it's also sometimes 1 then why not if (num > 1) - just as optimization...

Richard.

> 2014-06-27  Jakub Jelinek  <ja...@redhat.com>
>
>         * ira-build.c (sort_conflict_id_map): Don't call
>         qsort if num is 0, as ira_object_id_map might be NULL.
>
> --- gcc/ira-build.c.jj  2014-05-30 10:51:16.000000000 +0200
> +++ gcc/ira-build.c     2014-06-26 20:21:43.428987181 +0200
> @@ -2821,8 +2821,9 @@ sort_conflict_id_map (void)
>        FOR_EACH_ALLOCNO_OBJECT (a, obj, oi)
>         ira_object_id_map[num++] = obj;
>      }
> -  qsort (ira_object_id_map, num, sizeof (ira_object_t),
> -        object_range_compare_func);
> +  if (num)
> +    qsort (ira_object_id_map, num, sizeof (ira_object_t),
> +          object_range_compare_func);
>    for (i = 0; i < num; i++)
>      {
>        ira_object_t obj = ira_object_id_map[i];
>
>         Jakub

Reply via email to