diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-03-05 17:49:49 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-03-05 17:49:49 +0000 |
commit | fd82d052a059f54724304f455f5bc459d33ba814 (patch) | |
tree | 3a32f1c92334c72cd658898f32c981ab9b792fea | |
parent | 0f23e403011f1176391666227f40ab628a1e942c (diff) | |
download | gcc-fd82d052a059f54724304f455f5bc459d33ba814.tar.gz |
PR ipa/65318
* ipa-icf.c (sem_variable::equals): Compare variables types.
* gcc.dg/ipa/pr65318.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221221 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ipa-icf.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/pr65318.c | 18 |
4 files changed, 33 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 73a346a5f4a..f78091957da 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-03-05 Martin Liska <mliska@suse.cz> + + PR ipa/65318 + * ipa-icf.c (sem_variable::equals): Compare variables types. + 2015-03-05 Alex Velenko <alex.velenko@arm.com> * config/arm/arm.c (arm_function_in_section_p): Fix predicate to diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index c55a09f7281..a7f19d6fd8d 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -1501,6 +1501,11 @@ sem_variable::equals (sem_item *item, if (DECL_INITIAL (item->decl) == error_mark_node && in_lto_p) dyn_cast <varpool_node *>(item->node)->get_constructor (); + /* As seen in PR ipa/65303 we have to compare variables types. */ + if (!func_checker::compatible_types_p (TREE_TYPE (decl), + TREE_TYPE (item->decl))) + return return_false_with_msg ("variables types are different"); + ret = sem_variable::equals (DECL_INITIAL (decl), DECL_INITIAL (item->node->decl)); if (dump_file && (dump_flags & TDF_DETAILS)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4f853ee4ca9..09d42b3d851 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-03-05 Martin Liska <mliska@suse.cz> + + PR ipa/65318 + * gcc.dg/ipa/pr65318.c: New test. + 2015-03-05 Marek Polacek <polacek@redhat.com> * c-c++-common/ubsan/bounds-6.c: Use dg-do run. diff --git a/gcc/testsuite/gcc.dg/ipa/pr65318.c b/gcc/testsuite/gcc.dg/ipa/pr65318.c new file mode 100644 index 00000000000..f23b3a2c36f --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr65318.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-ipa-icf-details" } */ + +static short a = 0; +short b = -1; +static unsigned short c = 0; + +int +main () +{ + if (a <= b) + return 1; + + return 0; +} + +/* { dg-final { scan-ipa-dump "Equal symbols: 0" "icf" } } */ +/* { dg-final { cleanup-ipa-dump "icf" } } */ |