This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Instrument function clones using mudflap (PR libmudflap/40778)


On Thu, Dec 16, 2010 at 10:55 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> As discussed in the PR, clones are DECL_ARTIFICIAL, so
> execute_mudflap_function_ops pass wasn't done on them. ?Skipping
> the instrumentation of really artificial functions is ok, but
> clones (and OpenMP functions etc.) are really user routines or parts
> thereof.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?

Hmm, instead of tree flags don't we have some cgraph state we can query?
Why do we not want to instrument compiler-generated functions?

Richard.

> 2010-12-16 ?Jakub Jelinek ?<jakub@redhat.com>
>
> ? ? ? ?PR libmudflap/40778
> ? ? ? ?* tree-mudflap.c (execute_mudflap_function_ops): Instrument
> ? ? ? ?even artificial functions, if their DECL_ORIGIN is not artificial.
>
> ? ? ? ?* testsuite/libmudflap.c/fail68-frag.c: New test.
>
> --- gcc/tree-mudflap.c.jj ? ? ? 2010-12-02 11:51:32.000000000 +0100
> +++ gcc/tree-mudflap.c ?2010-12-16 18:04:49.000000000 +0100
> @@ -411,9 +411,11 @@ execute_mudflap_function_ops (void)
> ? struct gimplify_ctx gctx;
>
> ? /* Don't instrument functions such as the synthetic constructor
> - ? ? built during mudflap_finish_file. ?*/
> - ?if (mf_marked_p (current_function_decl) ||
> - ? ? ?DECL_ARTIFICIAL (current_function_decl))
> + ? ? built during mudflap_finish_file. ?Do instrument clones or
> + ? ? other artificial functions created from user code. ?*/
> + ?if (mf_marked_p (current_function_decl)
> + ? ? ?|| (DECL_ARTIFICIAL (current_function_decl)
> + ? ? ? ? && DECL_ARTIFICIAL (DECL_ORIGIN (current_function_decl))))
> ? ? return 0;
>
> ? push_gimplify_context (&gctx);
> --- libmudflap/testsuite/libmudflap.c/fail68-frag.c.jj ?2010-12-16 17:15:40.000000000 +0100
> +++ libmudflap/testsuite/libmudflap.c/fail68-frag.c ? ? 2010-12-16 17:26:16.000000000 +0100
> @@ -0,0 +1,27 @@
> +/* PR libmudflap/40778 */
> +
> +char p[32];
> +static int j;
> +
> +__attribute__((noinline))
> +static void foo (int i)
> +{
> + ?if (j++ == 0)
> + ? ?p[i + 4] = 12;
> + ?else
> + ? ?p[i - 4] = 13;
> +}
> +
> +int
> +main ()
> +{
> + ?foo (30);
> + ?foo (30);
> + ?foo (30);
> + ?return 0;
> +}
> +
> +/* { dg-output "mudflap violation 1.*" } */
> +/* { dg-output "Nearby object 1.*" } */
> +/* { dg-output "mudflap object.*name.*p" } */
> +/* { dg-do run { xfail *-*-* } } */
>
> ? ? ? ?Jakub
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]