This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/83954] [6/7/8 Regression] LTO: Bogus -Wlto-type-mismatch warning for array of pointer to incomplete type
- From: "dobonachea at lbl dot gov" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 26 Jan 2018 16:20:30 +0000
- Subject: [Bug lto/83954] [6/7/8 Regression] LTO: Bogus -Wlto-type-mismatch warning for array of pointer to incomplete type
- Auto-submitted: auto-generated
- References: <bug-83954-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83954
--- Comment #8 from Dan Bonachea <dobonachea at lbl dot gov> ---
(In reply to Jan Hubicka from comment #7)
> This should silence the warning.
> Index: lto-symtab.c
> ===================================================================
> --- lto-symtab.c (revision 257048)
> +++ lto-symtab.c (working copy)
> @@ -285,7 +285,9 @@ warn_type_compatibility_p (tree prevaili
> alias_set_type set2 = get_alias_set (prevailing_type);
>
> if (set1 && set2 && set1 != set2
> - && (!POINTER_TYPE_P (type) || !POINTER_TYPE_P (prevailing_type)
> + && (((!POINTER_TYPE_P (type) || !POINTER_TYPE_P (prevailing_type))
> + && (TREE_CODE (type) != ARRAY_TYPE
> + || TREE_CODE (prevailing_type) != ARRAY_TYPE))
> || (set1 != TYPE_ALIAS_SET (ptr_type_node)
> && set2 != TYPE_ALIAS_SET (ptr_type_node))))
> lev |= 5;
Thanks Jan! I've confirmed this patch is sufficient to silence the warning when
applied to gcc 7.3.0, for both this reduced test case and the original program.
Can we get this merged into the gcc development branch(es)?