re PR debug/48333 (-fcompare-debug failure (length) - "memmove" x "__builtin_memmove")
authorAlexandre Oliva <aoliva@redhat.com>
Sat, 4 Jun 2011 10:08:09 +0000 (10:08 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Sat, 4 Jun 2011 10:08:09 +0000 (10:08 +0000)
PR debug/48333
* calls.c (emit_call_1): Prefer the __builtin declaration of
builtin functions.

From-SVN: r174636

gcc/ChangeLog
gcc/calls.c

index cdb14e9c289bc6edd6c9fdd3294848c03948a273..c7f031f4ade1479c43a14bbc832311b18a6bc371 100644 (file)
@@ -1,3 +1,9 @@
+2011-06-04  Alexandre Oliva  <aoliva@redhat.com>
+
+       PR debug/48333
+       * calls.c (emit_call_1): Prefer the __builtin declaration of
+       builtin functions.
+
 2011-06-03   Diego Novillo  <dnovillo@google.com>
 
        * lto-streamer-in.c (unpack_value_fields): Remove unneeded asserts.
index 512ff0e4912ae29661943668ce60b27b39f02ea0..f5592c5a6d9461dfaa5e76981c2eb2d64a58e656 100644 (file)
@@ -272,7 +272,20 @@ emit_call_1 (rtx funexp, tree fntree ATTRIBUTE_UNUSED, tree fndecl ATTRIBUTE_UNU
 
   funmem = gen_rtx_MEM (FUNCTION_MODE, funexp);
   if (fndecl && TREE_CODE (fndecl) == FUNCTION_DECL)
-    set_mem_expr (funmem, fndecl);
+    {
+      tree t = fndecl;
+      /* Although a built-in FUNCTION_DECL and its non-__builtin
+        counterpart compare equal and get a shared mem_attrs, they
+        produce different dump output in compare-debug compilations,
+        if an entry gets garbage collected in one compilation, then
+        adds a different (but equivalent) entry, while the other
+        doesn't run the garbage collector at the same spot and then
+        shares the mem_attr with the equivalent entry. */
+      if (DECL_BUILT_IN_CLASS (t) == BUILT_IN_NORMAL
+         && built_in_decls[DECL_FUNCTION_CODE (t)])
+       t = built_in_decls[DECL_FUNCTION_CODE (t)];
+      set_mem_expr (funmem, t);
+    }
   else if (fntree)
     set_mem_expr (funmem, build_simple_mem_ref (CALL_EXPR_FN (fntree)));