]> gcc.gnu.org Git - gcc.git/commitdiff
Fix typo in merge_call_lhs_flags
authorJan Hubicka <jh@suse.cz>
Mon, 29 Mar 2021 18:09:35 +0000 (20:09 +0200)
committerJan Hubicka <jh@suse.cz>
Mon, 29 Mar 2021 18:09:35 +0000 (20:09 +0200)
gcc/ChangeLog:

2021-03-29  Jan Hubicka  <hubicka@ucw.cz>

* ipa-modref.c (merge_call_lhs_flags): Correct handling of deref.
(analyze_ssa_name_flags): Fix typo in comment.

gcc/testsuite/ChangeLog:

2021-03-29  Jan Hubicka  <hubicka@ucw.cz>

* gcc.c-torture/compile/pr99751.c: New test.

gcc/ipa-modref.c
gcc/testsuite/gcc.c-torture/compile/pr99751.c [new file with mode: 0644]

index 7aaf53be8f4613ea4e1fb1058c37e4c34d3e0f17..5f33bb5b4104947ed420864cf76635411e25c9b5 100644 (file)
@@ -1545,9 +1545,9 @@ merge_call_lhs_flags (gcall *call, int arg, int index, bool deref,
       tree lhs = gimple_call_lhs (call);
       analyze_ssa_name_flags (lhs, lattice, depth + 1, ipa);
       if (deref)
-       lattice[index].merge (lattice[SSA_NAME_VERSION (lhs)]);
-      else
        lattice[index].merge_deref (lattice[SSA_NAME_VERSION (lhs)], false);
+      else
+       lattice[index].merge (lattice[SSA_NAME_VERSION (lhs)]);
     }
   /* In the case of memory store we can do nothing.  */
   else
@@ -1621,7 +1621,7 @@ analyze_ssa_name_flags (tree name, vec<modref_lattice> &lattice, int depth,
       else if (gcall *call = dyn_cast <gcall *> (use_stmt))
        {
          tree callee = gimple_call_fndecl (call);
-         /* Return slot optiomization would require bit of propagation;
+         /* Return slot optimization would require bit of propagation;
             give up for now.  */
          if (gimple_call_return_slot_opt_p (call)
              && gimple_call_lhs (call) != NULL_TREE
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr99751.c b/gcc/testsuite/gcc.c-torture/compile/pr99751.c
new file mode 100644 (file)
index 0000000..f1d5101
--- /dev/null
@@ -0,0 +1,20 @@
+int *ptr1 = 0, **ptr2 = &ptr1;
+
+int *identity(int *p)
+{
+  return p;
+}
+
+void store_to_c(int *p)
+{
+  *ptr2 = identity(p);
+}
+
+int main()
+{
+  int f;
+  store_to_c(&f);
+  if (ptr1 != &f)
+    __builtin_abort();
+  return 0;
+}
This page took 0.068624 seconds and 5 git commands to generate.