From e300ec2d1c230ea60b3f6eb36945ea87a0a7bc73 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 18 Jan 2013 21:24:34 +0100 Subject: [PATCH] re PR tree-optimization/56029 (ICE: verify_gimple failed, location references block not in block tree) PR tree-optimization/56029 * tree-phinodes.c (reserve_phi_args_for_new_edge): Set gimple_phi_arg_location for the new arg to UNKNOWN_LOCATION. * g++.dg/torture/pr56029.C: New test. From-SVN: r195304 --- gcc/ChangeLog | 6 ++ gcc/testsuite/ChangeLog | 5 + gcc/testsuite/g++.dg/torture/pr56029.C | 126 +++++++++++++++++++++++++ gcc/tree-phinodes.c | 1 + 4 files changed, 138 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr56029.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 31132772e01..2d7a0421dde 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-01-18 Jakub Jelinek + + PR tree-optimization/56029 + * tree-phinodes.c (reserve_phi_args_for_new_edge): Set + gimple_phi_arg_location for the new arg to UNKNOWN_LOCATION. + 2013-01-18 Sharad Singhai PR tree-optimization/55995 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 20ebbbb872a..0640b26bcd0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-01-18 Jakub Jelinek + + PR tree-optimization/56029 + * g++.dg/torture/pr56029.C: New test. + 2013-01-18 Sharad Singhai PR tree-optimization/55995 diff --git a/gcc/testsuite/g++.dg/torture/pr56029.C b/gcc/testsuite/g++.dg/torture/pr56029.C new file mode 100644 index 00000000000..ca4a82a0060 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr56029.C @@ -0,0 +1,126 @@ +// PR tree-optimization/56029 +// { dg-do compile } + +template +struct DefaultDeleter +{ + void operator () (T * ptr) { delete ptr; } +}; +template +struct scoped_ptr_impl +{ + scoped_ptr_impl (T * p):data_ (p) {} + template + scoped_ptr_impl (scoped_ptr_impl *other):data_ (other->release (), get_deleter ()) {} + ~scoped_ptr_impl () { static_cast (data_) (data_.ptr); } + void reset (T * p) { data_.ptr = p; } + D get_deleter () {} + T *release () { data_.ptr = __null; } + struct Data + : D + { + Data (T *) : ptr () {} + Data (T *, D) : D (), ptr () {} + T *ptr; + }; + Data data_; +}; +template > +struct scoped_ptr +{ + struct RValue + { + RValue (scoped_ptr * object):object (object) {} + scoped_ptr *object; + }; + scoped_ptr Pass () { return scoped_ptr ((this)); } + typedef T element_type; + typedef D deleter_type; + scoped_ptr () : impl_ (__null) {} + scoped_ptr (RValue rvalue) : impl_ (&rvalue.object->impl_) {} + void reset (element_type * p) { impl_.reset (p); } + scoped_ptr_impl impl_; +}; +template +struct Callback; +struct ClientSocketFactory; +struct DatagramClientSocket; +struct DnsSocketPool +{ + scoped_ptr CreateConnectedSocket (); + ClientSocketFactory *socket_factory_; +}; +int RandInt (int, int); +struct BindStateBase {}; +struct CallbackBase +{ + CallbackBase (BindStateBase *); + ~CallbackBase (); +}; +template +struct BindState; +template +struct Callback : CallbackBase +{ + template + Callback (BindState *bind_state) : CallbackBase (bind_state) {} +}; +typedef Callback +RandIntCallback; +struct ClientSocketFactory +{ + virtual DatagramClientSocket *CreateDatagramClientSocket (RandIntCallback) = 0; +}; +template +struct RunnableAdapter; +template +struct RunnableAdapter +{ + typedef R (RunType) (A1, A2); +}; +template +struct FunctorTraits +{ + typedef RunnableAdapter RunnableType; + typedef typename RunnableType::RunType RunType; +}; +template +typename FunctorTraits ::RunnableType MakeRunnable (T) +{ +} +template +struct Invoker; +template +struct Invoker <0, StorageType, R (X1, X2)> +{ + typedef R (UnboundRunType) (X1, X2); +}; +template +struct BindState : BindStateBase +{ + typedef Runnable RunnableType; + typedef Invoker <0, BindState, RunType> InvokerType; + typedef typename InvokerType::UnboundRunType UnboundRunType; + BindState (Runnable):runnable_ () {} + RunnableType runnable_; +}; +template +Callback ::RunnableType, typename FunctorTraits ::RunType, void ()>::UnboundRunType> +Bind (Functor functor) +{ + typedef typename FunctorTraits ::RunnableType RunnableType; + typedef typename FunctorTraits ::RunType RunType; + typedef BindState BindState; + Callback (new BindState (MakeRunnable (functor))); +} +struct DatagramClientSocket +{ + virtual ~ DatagramClientSocket (); +}; +scoped_ptr +DnsSocketPool::CreateConnectedSocket () +{ + scoped_ptr socket; + socket.reset (socket_factory_->CreateDatagramClientSocket (Bind (RandInt))); + socket.Pass (); +} diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c index 50f3725998e..03a20faa9c0 100644 --- a/gcc/tree-phinodes.c +++ b/gcc/tree-phinodes.c @@ -312,6 +312,7 @@ reserve_phi_args_for_new_edge (basic_block bb) redirects edges, and then fixes up PHI arguments later in batch. */ SET_PHI_ARG_DEF (stmt, len - 1, NULL_TREE); + gimple_phi_arg_set_location (stmt, len - 1, UNKNOWN_LOCATION); stmt->gimple_phi.nargs++; } -- 2.30.2