This is the mail archive of the gcc-bugs@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]

[Bug lto/83954] [6/7/8 Regression] LTO: Bogus -Wlto-type-mismatch warning for array of pointer to incomplete type


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)?

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