From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6468 invoked by alias); 20 Dec 2012 14:31:39 -0000 Received: (qmail 6390 invoked by uid 55); 20 Dec 2012 14:31:19 -0000 From: "tejohnson at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/55734] [4.8 Regression] gcov-io.c uses builtins not available in non-GCC compilers Date: Thu, 20 Dec 2012 14:31:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: gcov-profile X-Bugzilla-Keywords: build X-Bugzilla-Severity: blocker X-Bugzilla-Who: tejohnson at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-12/txt/msg01976.txt.bz2 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 Jakub Jelinek 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