aboutsummaryrefslogtreecommitdiff
blob: 182ff073f62fe63fecebffc6f2b6c4ecbe6f7ba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
https://bugs.gentoo.org/672032
https://gcc.gnu.org/PR88214

From a2fd08219c82eba4d1d15f260db98c2e154268f2 Mon Sep 17 00:00:00 2001
From: jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 10 Dec 2018 12:45:47 +0000
Subject: [PATCH] [PR 88214] Check that an argument is a pointer

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
--- 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;
--- /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.19.2