aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2019-06-21 10:36:00 -0600
committerJeff Law <law@gcc.gnu.org>2019-06-21 10:36:00 -0600
commit84338a14985c5f7b064a181180d221be16019978 (patch)
tree088907659d2a6de6d4f20dd87360f8ec8a2399af
parent1296eaf6ed32a3474f39b34dc0af6583a2d80096 (diff)
downloadgcc-84338a14985c5f7b064a181180d221be16019978.zip
gcc-84338a14985c5f7b064a181180d221be16019978.tar.gz
gcc-84338a14985c5f7b064a181180d221be16019978.tar.bz2
re PR tree-optimization/90949 (null pointer check removed)
PR tree-optimization/90949 * tree-ssa-copy.c (fini_copy_prop): Use reset_flow_sensitive_info. * tree-ssanames.c (reset_flow_sensitive_info): Reset non-null state. * gcc.c-torture/execute/pr90949.c: New test. From-SVN: r272555
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr90949.c42
-rw-r--r--gcc/tree-ssa-copy.c11
-rw-r--r--gcc/tree-ssanames.c7
5 files changed, 64 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 73375ce..fa45d9d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2019-06-21 Jeff Law <law@redhat.com>
+
+ PR tree-optimization/90949
+ * tree-ssa-copy.c (fini_copy_prop): Use reset_flow_sensitive_info.
+ * tree-ssanames.c (reset_flow_sensitive_info): Reset non-null state.
+
2019-06-21 Richard Biener <rguenther@suse.de>
PR debug/90914
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 55ca5ab..3f99b80 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-06-21 Jeff Law <law@redhat.com>
+
+ PR tree-optimization/90949
+ * gcc.c-torture/execute/pr90949.c: New test.
+
2019-06-21 Marek Polacek <polacek@redhat.com>
PR c++/90953 - ICE with -Wmissing-format-attribute.
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr90949.c b/gcc/testsuite/gcc.c-torture/execute/pr90949.c
new file mode 100644
index 0000000..8c2ae39
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr90949.c
@@ -0,0 +1,42 @@
+void __attribute__ ((noipa, noinline)) my_puts (const char *str) { }
+
+void __attribute__ ((noipa, noinline)) my_free (void *p) { }
+
+
+struct Node
+{
+ struct Node *child;
+};
+
+struct Node space[2] = { };
+
+struct Node * __attribute__ ((noipa, noinline)) my_malloc (int bytes)
+{
+ return &space[0];
+}
+
+void
+walk (struct Node *module, int cleanup)
+{
+ if (module == 0)
+ {
+ return;
+ }
+ if (!cleanup)
+ {
+ my_puts ("No cleanup");
+ }
+ walk (module->child, cleanup);
+ if (cleanup)
+ {
+ my_free (module);
+ }
+}
+
+int
+main ()
+{
+ struct Node *node = my_malloc (sizeof (struct Node));
+ node->child = 0;
+ walk (node, 1);
+}
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index 8953263..28ff8d3 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -545,13 +545,12 @@ fini_copy_prop (void)
duplicate_ssa_name_ptr_info (copy_of[i].value,
SSA_NAME_PTR_INFO (var));
/* Points-to information is cfg insensitive,
- but alignment info might be cfg sensitive, if it
- e.g. is derived from VRP derived non-zero bits.
- So, do not copy alignment info if the two SSA_NAMEs
- aren't defined in the same basic block. */
+ but [E]VRP might record context sensitive alignment
+ info, non-nullness, etc. So reset context sensitive
+ info if the two SSA_NAMEs aren't defined in the same
+ basic block. */
if (var_bb != copy_of_bb)
- mark_ptr_info_alignment_unknown
- (SSA_NAME_PTR_INFO (copy_of[i].value));
+ reset_flow_sensitive_info (copy_of[i].value);
}
else if (!POINTER_TYPE_P (TREE_TYPE (var))
&& SSA_NAME_RANGE_INFO (var)
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index 5bac799..8b80bce 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -820,7 +820,12 @@ reset_flow_sensitive_info (tree name)
{
/* points-to info is not flow-sensitive. */
if (SSA_NAME_PTR_INFO (name))
- mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name));
+ {
+ /* [E]VRP can derive context sensitive alignment info and
+ non-nullness properties. We must reset both. */
+ mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name));
+ SSA_NAME_PTR_INFO (name)->pt.null = 1;
+ }
}
else
SSA_NAME_RANGE_INFO (name) = NULL;