re PR lto/78562 (Wrong warning for built-in functions with -flto)
authorGeorg-Johann Lay <avr@gjlay.de>
Wed, 30 Nov 2016 11:08:37 +0000 (11:08 +0000)
committerGeorg-Johann Lay <gjl@gcc.gnu.org>
Wed, 30 Nov 2016 11:08:37 +0000 (11:08 +0000)
gcc/lto/
PR lto/78562
* lto-symtab.c (lto_symtab_merge_decls_2): Don't diagnose type
mismatch if the two types are built-in.

From-SVN: r243008

gcc/lto/ChangeLog
gcc/lto/lto-symtab.c

index 7957b2b7deff65d16707470cc89a14b33d8487ab..cf2248061c586837eae537643bc530c160472d6f 100644 (file)
@@ -1,3 +1,9 @@
+2016-11-30  Georg-Johann Lay  <avr@gjlay.de>
+
+       PR lto/78562
+       * lto-symtab.c (lto_symtab_merge_decls_2): Don't diagnose type
+       mismatch if the two types are built-in.
+
 2016-11-26  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        * lto-lang.c (lto_init): Remove initialization of ptrdiff_type_node.
index ce9e1465e3c186f9d55d815f9d0e8acbc5e53f7b..5ab9977ffea6f68ec40b188f40e6490b864cb9c5 100644 (file)
@@ -655,6 +655,14 @@ lto_symtab_merge_decls_2 (symtab_node *first, bool diagnosed_p)
   /* Diagnose all mismatched re-declarations.  */
   FOR_EACH_VEC_ELT (mismatches, i, decl)
     {
+      /* Do not diagnose two built-in declarations, there is no useful
+         location in that case.  It also happens for AVR if two built-ins
+         use the same asm name because their libgcc assembler code is the
+         same, see PR78562.  */
+      if (DECL_IS_BUILTIN (prevailing->decl)
+         && DECL_IS_BUILTIN (decl))
+       continue;
+
       int level = warn_type_compatibility_p (TREE_TYPE (prevailing->decl),
                                             TREE_TYPE (decl),
                                             DECL_COMDAT (decl));