Bug 42115 - r154072 & r154073 break build of ppl, non-placement deallocation issue
Summary: r154072 & r154073 break build of ppl, non-placement deallocation issue
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Jason Merrill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-20 01:45 UTC by Rainer Emrich
Modified: 2009-11-20 05:06 UTC (History)
2 users (show)

See Also:
Host: *-*-mingw32
Target: *-*-mingw32
Build: *-*-mingw32
Known to work:
Known to fail:
Last reconfirmed: 2009-11-20 03:06:00


Attachments
preprocessed source, still quite large (142.65 KB, application/gzip)
2009-11-20 01:47 UTC, Rainer Emrich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Emrich 2009-11-20 01:45:06 UTC
There is an issue with non-placement deallocation:

In file included from ../../../../../../../src/ppl-0.10.2/src/Row.defs.hh:504:0,
                 from ../../../../../../../src/ppl-0.10.2/src/Linear_Row.defs.hh:28,
                 from ../../../../../../../src/ppl-0.10.2/src/Constraint.defs.hh:28,
                 from ../../../../../../../src/ppl-0.10.2/src/Box.defs.hh:33,
                 from ../../../../../../../src/ppl-0.10.2/src/Box.cc:24:
../../../../../../../src/ppl-0.10.2/src/Row.inlines.hh: In member function 'void Parma_Polyhedra_Library::Row::allocate(Parma_Polyhedra_Library::dimension_type, Parma_Polyhedra_Library::Row::Flags)':
../../../../../../../src/ppl-0.10.2/src/Row.inlines.hh:92:1: error: non-placement deallocation function 'static void Parma_Polyhedra_Library::Row_Impl_Handler::Impl::operator delete(void*, Parma_Polyhedra_Library::dimension_type)'
../../../../../../../src/ppl-0.10.2/src/Row.inlines.hh:224:31: error: selected for placement delete

caused by:

Author: jason
Date: Tue Nov 10 18:18:51 2009
New Revision: 154072

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154072
Log:
	PR c++/34158
	PR c++/36406
	* call.c (non_placement_deallocation_fn_p): Split out...
	(build_op_delete_call): ...from here.  Use instantiate_type
	for placement delete.  Simplify logic.
	* pt.c (primary_template_instantiation_p): Non-static.
	* cp-tree.h: Declare it.

Added:
    trunk/gcc/testsuite/g++.dg/init/placement4.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


and


Author: jason
Date: Tue Nov 10 18:31:22 2009
New Revision: 154073

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154073
Log:
	* call.c (build_op_delete_call): Tweak error.

Added:
    trunk/gcc/testsuite/g++.dg/init/placement5.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/testsuite/ChangeLog
Comment 1 Rainer Emrich 2009-11-20 01:47:33 UTC
Created attachment 19063 [details]
preprocessed source, still quite large
Comment 2 Jason Merrill 2009-11-20 03:05:59 UTC
I just had another email exchange about this, but can't find it right now.  Anyway, 5.3.4 [expr.new]:

A declaration of a placement deallocation function matches the declaration of a placement allocation function if it has the same number of parameters and, after parameter transformations (8.3.5), all parameter types except the first are identical. Any non-placement deallocation function matches a non-placement allocation function. If the lookup finds a single matching deallocation function, that function will be called; otherwise, no deallocation function will be called. If the lookup finds the two-parameter form of a usual deallocation function (3.7.4.2) and that function, considered as a placement deallocation function, would have been selected as a match for the allocation function, the program is ill-formed. [ Example:
      struct S {
         // Placement allocation function:
         static void* operator new(std::size_t, std::size_t);
         // Usual (non-placement) deallocation function:
         static void operator delete(void*, std::size_t);
      };
// ill-formed: non-placement deallocation function matches
// placement allocation function
      S* p = new (0) S;       
    — end example ]
Comment 3 Jason Merrill 2009-11-20 03:10:14 UTC
That said, I can see a reading whereby since PPL also defines operator delete (void *), the operator delete (void *, size_t) isn't the usual deallocation function, so we shouldn't give an error.  I'll implement that.
Comment 4 Jason Merrill 2009-11-20 05:03:38 UTC
Subject: Bug 42115

Author: jason
Date: Fri Nov 20 05:03:21 2009
New Revision: 154357

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154357
Log:
	PR c++/42115
	* call.c (build_op_delete_call): Don't complain about using
	op delete (void *, size_t) for placement delete if there's an
	op delete (void *).

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/init/placement5.C

Comment 5 Jason Merrill 2009-11-20 05:06:14 UTC
Fixed.