]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PR 88214] Check that an argument is a pointer
authorMartin Jambor <mjambor@suse.cz>
Wed, 16 Jan 2019 15:41:07 +0000 (16:41 +0100)
committerMartin Jambor <jamborm@gcc.gnu.org>
Wed, 16 Jan 2019 15:41:07 +0000 (16:41 +0100)
2019-01-16  Martin Jambor  <mjambor@suse.cz>

Backported from mainline
2018-12-10  Martin Jambor  <mjambor@suse.cz>

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

gcc/ChangeLog
gcc/ipa-prop.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/ipa/pr88214.c [new file with mode: 0644]

index fe65521ba51735779a78bceea533125ed7bfb65a..8dd7731098e172f1e8f2853005f4d4bd4013c5cb 100644 (file)
@@ -1,3 +1,12 @@
+2019-01-16  Martin Jambor  <mjambor@suse.cz>
+
+       Backported from mainline
+       2018-12-10  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/88214
+       * ipa-prop.c (determine_locally_known_aggregate_parts): Make sure
+       we check pointers against pointers.
+
 2019-01-09  Eric Botcazou  <ebotcazou@adacore.com>
             James Clarke  <jrtc27@jrtc27.com>
 
index de2a1deb423402f0d966da9d886864b0f8bae026..ec78eae7a67cc8c954425890b451fdb61473e3d7 100644 (file)
@@ -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;
index c38575673f56b6bc88d4cf474769460c8f7deb73..af4e7a338a8be7026671108b0c28b037f8db7fa2 100644 (file)
@@ -1,3 +1,11 @@
+2019-01-16  Martin Jambor  <mjambor@suse.cz>
+
+       Backported from mainline
+       2018-12-10  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/88214
+       * gcc.dg/ipa/pr88214.c: New test.
+
 2019-01-15  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        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 (file)
index 0000000..4daa982
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void i();
+  short a;
+  void b(e) char * e;
+  {
+    i();
+    b(a);
+  }