]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR ipa/62015 (ipa-cp-clone uses a clone that is too specialized for the call context)
authorMartin Jambor <mjambor@suse.cz>
Wed, 3 Sep 2014 16:36:06 +0000 (18:36 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Wed, 3 Sep 2014 16:36:06 +0000 (18:36 +0200)
2014-09-03  Martin Jambor  <mjambor@suse.cz>

PR ipa/62015
* ipa-cp.c (intersect_aggregates_with_edge): Handle impermissible
pass-trough jump functions correctly.

testsuite/
* g++.dg/ipa/pr62015.C: New test.

From-SVN: r214885

gcc/ChangeLog
gcc/ipa-cp.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/pr62015.C [new file with mode: 0644]

index 43f5df40075be0a76a1a952e0b8469e8a6b8bc34..7f7642fa6a73b6b7648d38adfda58c8279d99967 100644 (file)
@@ -1,3 +1,9 @@
+2014-09-03  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/62015
+       * ipa-cp.c (intersect_aggregates_with_edge): Handle impermissible
+       pass-trough jump functions correctly.
+
 2014-09-03  Martin Jambor  <mjambor@suse.cz>
 
        PR ipa/61986
index 55e02b94a11aab77c70fa759a301b8a02a3242fe..b7db0cc129dd57fff5980c854d16f345ad889609 100644 (file)
@@ -2904,6 +2904,11 @@ intersect_aggregates_with_edge (struct cgraph_edge *cs, int index,
                intersect_with_agg_replacements (cs->caller, src_idx,
                                                 &inter, 0);
            }
+         else
+           {
+             inter.release ();
+             return vNULL;
+           }
        }
       else
        {
@@ -2919,6 +2924,11 @@ intersect_aggregates_with_edge (struct cgraph_edge *cs, int index,
              else
                intersect_with_plats (src_plats, &inter, 0);
            }
+         else
+           {
+             inter.release ();
+             return vNULL;
+           }
        }
     }
   else if (jfunc->type == IPA_JF_ANCESTOR
index 7d328751cb3283b63fa19a054ea010581b6aeae0..cdc118d83d221b7643ad1bc105c779f67f5dbfae 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-03  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/62015
+       * g++.dg/ipa/pr62015.C: New test.
+
 2014-09-03  Martin Jambor  <mjambor@suse.cz>
 
        PR ipa/61986
diff --git a/gcc/testsuite/g++.dg/ipa/pr62015.C b/gcc/testsuite/g++.dg/ipa/pr62015.C
new file mode 100644 (file)
index 0000000..950b46e
--- /dev/null
@@ -0,0 +1,55 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -std=c++11"  } */
+
+
+extern "C" int printf(const char *fmt, ...);
+extern "C" void abort(void);
+
+struct Side {
+    enum _Value { Left, Right, Invalid };
+
+    constexpr Side() : _value(Invalid) {}
+    constexpr Side(_Value value) : _value(value) {}
+    operator _Value() const { return (_Value)_value; }
+
+  private:
+    char _value;
+};
+
+struct A {
+    void init();
+    void adjust(Side side, bool final);
+    void move(Side side);
+};
+
+void A::init()
+{
+    adjust(Side::Invalid, false);
+}
+
+static void __attribute__((noinline))
+check (int v, int final)
+{
+    if (v != 0)
+      abort();
+}
+
+
+__attribute__((noinline))
+void A::adjust(Side side, bool final)
+{
+  check ((int)side, final);
+}
+
+void A::move(Side side)
+{
+    adjust(side, false);
+    adjust(side, true);
+}
+
+int main()
+{
+    A t;
+    t.move(Side::Left);
+    return 0;
+}