From c8f403525ae53bc8cdba13ea5f8d8f9a95ed08d6 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Wed, 3 Sep 2014 16:26:38 +0200 Subject: [PATCH] re PR ipa/62015 (ipa-cp-clone uses a clone that is too specialized for the call context) 2014-09-03 Martin Jambor 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: r214878 --- gcc/ChangeLog | 6 ++++ gcc/ipa-cp.c | 10 ++++++ gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/g++.dg/ipa/pr62015.C | 55 ++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ipa/pr62015.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fdafce83461..de6481613d1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-09-03 Martin Jambor + + PR ipa/62015 + * ipa-cp.c (intersect_aggregates_with_edge): Handle impermissible + pass-trough jump functions correctly. + 2014-09-03 Martin Jambor PR ipa/61986 diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 58121d4df3e..d3656349016 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -3048,6 +3048,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 { @@ -3063,6 +3068,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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7d3c32b560d..f0bca8f0bc2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-09-03 Martin Jambor + + PR ipa/62015 + * g++.dg/ipa/pr62015.C: New test. + 2014-09-03 Martin Jambor 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 index 00000000000..950b46e759b --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr62015.C @@ -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; +} -- 2.30.2