re PR ipa/92883 (ICE in compare_values_warnv)
authorJakub Jelinek <jakub@redhat.com>
Tue, 10 Dec 2019 21:04:57 +0000 (22:04 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 10 Dec 2019 21:04:57 +0000 (22:04 +0100)
PR ipa/92883
* ipa-cp.c (propagate_vr_across_jump_function): Pass jvr rather
than *jfunc->m_vr to intersect.  Formatting fix.

* gcc.dg/ipa/pr92883.c: New test.

From-SVN: r279194

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

index 4504e3c9115ed22188dc7901d697ad30dbdc2b94..71609c9121f07eed74139e3f63aaf1e1d3e54f6a 100644 (file)
@@ -1,5 +1,9 @@
 2019-12-10  Jakub Jelinek  <jakub@redhat.com>
 
+       PR ipa/92883
+       * ipa-cp.c (propagate_vr_across_jump_function): Pass jvr rather
+       than *jfunc->m_vr to intersect.  Formatting fix.
+
        PR middle-end/92825
        * cfgexpand.c (add_stack_protection_conflicts): Change return type
        from void to bool, return true if at least one stack_vars[i].decl
index 14064ae0034daa53d81f85da643dd2bd12310cd8..1a80ccbde2ddc6ccc24d1191a11713908b426bbe 100644 (file)
@@ -2369,12 +2369,10 @@ propagate_vr_across_jump_function (cgraph_edge *cs, ipa_jump_func *jfunc,
 
       value_range vr;
       if (TREE_CODE_CLASS (operation) == tcc_unary)
-       {
-         ipa_vr_operation_and_type_effects (&vr,
-                                            &src_lats->m_value_range.m_vr,
-                                            operation, param_type,
-                                            operand_type);
-       }
+       ipa_vr_operation_and_type_effects (&vr,
+                                          &src_lats->m_value_range.m_vr,
+                                          operation, param_type,
+                                          operand_type);
       /* A crude way to prevent unbounded number of value range updates
         in SCC components.  We should allow limited number of updates within
         SCC, too.  */
@@ -2400,7 +2398,7 @@ propagate_vr_across_jump_function (cgraph_edge *cs, ipa_jump_func *jfunc,
                                                     NOP_EXPR,
                                                     param_type,
                                                     jfunc->m_vr->type ()))
-               vr.intersect (*jfunc->m_vr);
+               vr.intersect (jvr);
            }
          return dest_lat->meet_with (&vr);
        }
index 1d520d6a3d2f6c8694204169baa209f898b8bc3d..4f4a2a55e9b217f44f622841c430fa21468679e3 100644 (file)
@@ -1,5 +1,8 @@
 2019-12-10  Jakub Jelinek  <jakub@redhat.com>
 
+       PR ipa/92883
+       * gcc.dg/ipa/pr92883.c: New test.
+
        PR middle-end/92825
        * gcc.target/i386/pr92825.c: New test.
 
diff --git a/gcc/testsuite/gcc.dg/ipa/pr92883.c b/gcc/testsuite/gcc.dg/ipa/pr92883.c
new file mode 100644 (file)
index 0000000..a7c5dc6
--- /dev/null
@@ -0,0 +1,14 @@
+/* PR ipa/92883 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a, b, c, d;
+unsigned e;
+void baz (void *, int);
+void grault (int, unsigned long);
+int foo (unsigned g) { return a / g; }
+void bar (void *g) { if (b) baz (g, 5); }
+static void quux (int, unsigned long);
+static void qux (unsigned long g) { if (g) { d = foo (-1); quux (e, (d & 2) + g); } }
+static void quux (int g, unsigned long m) { (void) g; grault (c, m); bar (""); }
+void corge () { qux (e); }