From 63831879cf8e62d7dcae37bc339ffbd6b316087b Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Mon, 10 Dec 2018 13:45:47 +0100 Subject: [PATCH] [PR 88214] Check that an argument is a pointer 2018-12-10 Martin Jambor PR ipa/88214 * ipa-prop.c (determine_locally_known_aggregate_parts): Make sure we check pointers against pointers. testsuite/ * gcc.dg/ipa/pr88214.c: New test. From-SVN: r266953 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-prop.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/ipa/pr88214.c | 10 ++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/ipa/pr88214.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 41591ff..600cb47 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-12-10 Martin Jambor + + PR ipa/88214 + * ipa-prop.c (determine_locally_known_aggregate_parts): Make sure + we check pointers against pointers. + 2018-12-10 Richard Biener PR middle-end/88415 diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index f19b3ab..4a2a6fa 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1569,7 +1569,8 @@ determine_locally_known_aggregate_parts (gcall *call, tree arg, if (TREE_CODE (arg) == SSA_NAME) { tree type_size; - if (!tree_fits_uhwi_p (TYPE_SIZE (TREE_TYPE (arg_type)))) + if (!tree_fits_uhwi_p (TYPE_SIZE (TREE_TYPE (arg_type))) + || !POINTER_TYPE_P (TREE_TYPE (arg))) return; check_ref = true; arg_base = arg; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 20abb39..1f7d64a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-10 Martin Jambor + + PR ipa/88214 + * gcc.dg/ipa/pr88214.c: New test. + 2018-12-10 Jakub Jelinek PR testsuite/88369 diff --git a/gcc/testsuite/gcc.dg/ipa/pr88214.c b/gcc/testsuite/gcc.dg/ipa/pr88214.c new file mode 100644 index 0000000..4daa982 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr88214.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void i(); + short a; + void b(e) char * e; + { + i(); + b(a); + } -- 2.7.4