From: Martin Jambor Date: Wed, 16 Jan 2019 15:41:07 +0000 (+0100) Subject: [PR 88214] Check that an argument is a pointer X-Git-Tag: releases/gcc-7.5.0~656 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8a204051af71852f9c0ff1fc3405db868aeca82;p=thirdparty%2Fgcc.git [PR 88214] Check that an argument is a pointer 2019-01-16 Martin Jambor Backported from mainline 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: r267975 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fe65521ba517..8dd7731098e1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-01-16 Martin Jambor + + Backported from mainline + 2018-12-10 Martin Jambor + + PR ipa/88214 + * ipa-prop.c (determine_locally_known_aggregate_parts): Make sure + we check pointers against pointers. + 2019-01-09 Eric Botcazou James Clarke diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index de2a1deb4234..ec78eae7a67c 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1577,7 +1577,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 c38575673f56..af4e7a338a8b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-01-16 Martin Jambor + + Backported from mainline + 2018-12-10 Martin Jambor + + PR ipa/88214 + * gcc.dg/ipa/pr88214.c: New test. + 2019-01-15 Steven G. Kargl PR fortran/81849 diff --git a/gcc/testsuite/gcc.dg/ipa/pr88214.c b/gcc/testsuite/gcc.dg/ipa/pr88214.c new file mode 100644 index 000000000000..4daa9829e75f --- /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); + }