This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for PR target/32277 - IA64 profiling bug
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: sje at cup dot hp dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 14 Oct 2008 05:28:28 +0800
- Subject: Re: Patch for PR target/32277 - IA64 profiling bug
- References: <200810131642.m9DGg1504388@lucas.cup.hp.com>
On Tue, Oct 14, 2008 at 12:42 AM, Steve Ellcey <sje@cup.hp.com> wrote:
>
> This patch to fix PR 32277 is based on Andreas Schwab's fix. I just changed
> it do test the TARGET_VTABLE_USES_DESCRIPTORS macro instead of using the
> __ia64__ macro. This macro is only true for IA64 and it is set to 0 by
> default in defaults.h so it always has a value.
>
> The idea is that if you have function descriptors in your vtable then
> you could have two different descriptors pointing to the same function
> and you need to look at the function pointer inside the descriptor to
> see if the pointers being passed into __gcov_indirect_call_profiler
> point to the same function or not.
>
> Tested on IA64 HP-UX and Linux with no regressions.
>
> OK for checkin?
>
> Steve Ellcey
> sje@cup.hp.com
>
>
> 2008-10-13 Steve Ellcey <sje@cup.hp.com>
>
> PR target/32277
> * libgcov.c ( __gcov_indirect_call_profiler): Check
> TARGET_VTABLE_USES_DESCRIPTORS.
>
>
> Index: libgcov.c
> ===================================================================
> --- libgcov.c (revision 141083)
> +++ libgcov.c (working copy)
> @@ -777,7 +777,12 @@ void
> __gcov_indirect_call_profiler (gcov_type* counter, gcov_type value,
> void* cur_func, void* callee_func)
> {
> - if (cur_func == callee_func)
> + /* If the C++ virtual tables contain function descriptors then one
> + function may have multiple descriptors and we need to dereference
> + the descriptors to see if they point to the same function. */
> + if (cur_func == callee_func ||
^^ They should be on the
next line.
> + (TARGET_VTABLE_USES_DESCRIPTORS && callee_func &&
^^ They should be on the next line.
> + *(void **) cur_func == *(void **) callee_func))
> __gcov_one_value_profiler_body (counter, value);
> }
> #endif
>
--
H.J.