From: Martin Liska Date: Wed, 7 Mar 2018 09:43:49 +0000 (+0100) Subject: Backport r257343 X-Git-Tag: releases/gcc-6.5.0~477 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f7a5e0ba7b68c565abf9136b973cb3293ef6735;p=thirdparty%2Fgcc.git Backport r257343 2018-03-07 Martin Liska Backport from mainline 2018-02-02 Eric Botcazou PR lto/83954 * lto-symtab.c (warn_type_compatibility_p): Do not recurse into the component type of array types with non-aliased component. From-SVN: r258320 --- diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index b2cbe74fa6b4..5ad340e60898 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,12 @@ +2018-03-07 Martin Liska + + Backport from mainline + 2018-02-02 Eric Botcazou + + PR lto/83954 + * lto-symtab.c (warn_type_compatibility_p): Do not recurse into the + component type of array types with non-aliased component. + 2018-03-07 Martin Liska Backport from mainline diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c index 395dca479291..e6fb95fe3729 100644 --- a/gcc/lto/lto-symtab.c +++ b/gcc/lto/lto-symtab.c @@ -284,9 +284,12 @@ warn_type_compatibility_p (tree prevailing_type, tree type, { tree t1 = type, t2 = prevailing_type; - /* Alias sets of arrays are the same as alias sets of the inner - types. */ - while (TREE_CODE (t1) == ARRAY_TYPE && TREE_CODE (t2) == ARRAY_TYPE) + /* Alias sets of arrays with aliased components are the same as alias + sets of the inner types. */ + while (TREE_CODE (t1) == ARRAY_TYPE + && !TYPE_NONALIASED_COMPONENT (t1) + && TREE_CODE (t2) == ARRAY_TYPE + && !TYPE_NONALIASED_COMPONENT (t2)) { t1 = TREE_TYPE (t1); t2 = TREE_TYPE (t2);