http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55734
--- Comment #22 from tejohnson at gcc dot gnu.org 2012-12-20 14:31:18 UTC --- Author: tejohnson Date: Thu Dec 20 14:31:09 2012 New Revision: 194634 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194634 Log: Fix PR gcov-profile/55734 by using methods from hwint.c instead of builtins, to handle non-GCC and older versions of GCC. When building libgcov.a, however, hwint.c is not available, but we are always using the bootstrapped compiler and can therefore use the builtins. Use __builtin_popcount instead of __builtin_popcountll, since we are operating on an int. Use floor_log2 directly, instead of clz_hwi for the non-libgcov case, and handle situations where the size of the gcov_type is bigger than HOST_WIDE_INT. Verified that the various cases compiled by forcing different HOST_BITS_PER_WIDE_INT values. 2012-12-20 Teresa Johnson <tejohn...@google.com> Jakub Jelinek <ja...@redhat.com> PR gcov-profile/55734 * gcov-io.c (gcov_read_summary): Use __builtin_popcount instead of __builtin_popcountll when building libgcov.a, otherwise use popcount_hwi. (gcov_histo_index): When not building libgcov.a, use floor_log2 instead of __builtin_clzll. Modified: trunk/gcc/ChangeLog trunk/gcc/gcov-io.c