]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PR 88214] Check that an argument is a pointer
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 10 Dec 2018 12:45:47 +0000 (12:45 +0000)
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 10 Dec 2018 12:45:47 +0000 (12:45 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266953 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 41591ff0102327511ed897c4f2b4c7b08ec03e9f..600cb4738c3e925eff2b8ed0ce108ce7c63a6785 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2018-12-10  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/88415
index f19b3ab2b7f2331b0ea4005b35e83ffb287b9d36..4a2a6fa14cc6c42755e22dab0d1f3104e6a5147d 100644 (file)
@@ -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;
index 20abb395c207c3c0d85faecf3e2367c53986de17..1f7d64afd8eb44aae5601075746d36fc892e76d6 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-10  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/88214
+       * gcc.dg/ipa/pr88214.c: New test.
+
 2018-12-10  Jakub Jelinek  <jakub@redhat.com>
 
        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 (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);
+  }