From f615cb162df6f026d7f8798a74f0241df43251b1 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 19 Nov 2018 16:00:41 +0100 Subject: [PATCH] Fix condition in lto-symtab.c (PR lto/88077). 2018-11-19 Martin Liska PR lto/88077 * lto-symtab.c (lto_symtab_merge): Transform the condition before r256989. 2018-11-19 Martin Liska PR lto/88077 * gcc.dg/lto/pr88077_0.c: New test. * gcc.dg/lto/pr88077_1.c: New test. From-SVN: r266277 --- gcc/lto/ChangeLog | 6 ++++++ gcc/lto/lto-symtab.c | 5 +++-- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/lto/pr88077_0.c | 3 +++ gcc/testsuite/gcc.dg/lto/pr88077_1.c | 6 ++++++ 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/lto/pr88077_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/pr88077_1.c diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 4798663336c..4731e3f33b9 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2018-11-19 Martin Liska + + PR lto/88077 + * lto-symtab.c (lto_symtab_merge): Transform the + condition before r256989. + 2018-11-16 Martin Liska PR lto/88004 diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c index 18437eb2841..d018a16bd42 100644 --- a/gcc/lto/lto-symtab.c +++ b/gcc/lto/lto-symtab.c @@ -374,8 +374,9 @@ lto_symtab_merge (symtab_node *prevailing, symtab_node *entry) int a[]={1,2,3}; here the first declaration is COMMON and sizeof(a) == sizeof (int). */ - else if (TREE_CODE (type) == ARRAY_TYPE) - return (TYPE_SIZE (decl) == TYPE_SIZE (TREE_TYPE (type))); + else if (TREE_CODE (type) != ARRAY_TYPE + || (TYPE_SIZE (type) != TYPE_SIZE (TREE_TYPE (type)))) + return false; } return true; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c867217561..2b9f0c483ad 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -17,6 +17,12 @@ PR lto/87229 * g++.dg/lto/pr87229_0.C: New testcase. +2018-11-19 Martin Liska + + PR lto/88077 + * gcc.dg/lto/pr88077_0.c: New test. + * gcc.dg/lto/pr88077_1.c: New test. + 2018-11-19 Martin Liska * g++.dg/gcov/pr84548.C: Remove remove-gcda. diff --git a/gcc/testsuite/gcc.dg/lto/pr88077_0.c b/gcc/testsuite/gcc.dg/lto/pr88077_0.c new file mode 100644 index 00000000000..9e464b6ad4a --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr88077_0.c @@ -0,0 +1,3 @@ +/* { dg-lto-do link } */ + +int HeaderStr; diff --git a/gcc/testsuite/gcc.dg/lto/pr88077_1.c b/gcc/testsuite/gcc.dg/lto/pr88077_1.c new file mode 100644 index 00000000000..fd3de3e77a6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr88077_1.c @@ -0,0 +1,6 @@ +char HeaderStr[1]; + +int main() +{ + return 0; +} -- 2.30.2