This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA (make_dispatcher_decl): PATCH for c++/83911, ICE with multiversioned constructor
- From: Jason Merrill <jason at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 10 May 2018 15:33:13 -0400
- Subject: Re: RFA (make_dispatcher_decl): PATCH for c++/83911, ICE with multiversioned constructor
- References: <CADzB+2mJ9yJZ83o5_KhSFkikbqoUrqsjutVcy=+7eToDVkg2_Q@mail.gmail.com> <CADzB+2kKWMi9NpBq_RKWGqW1WPjg3c-gHY8UWg0TDDp=TAgQPw@mail.gmail.com> <CAFiYyc0Z5_iov3Q=qWazx0FtQmC-ZArRMz5TiFMG2m6KGvG2BQ@mail.gmail.com> <CADzB+2kf-DYaevy58NApJpXnoU+8wYVt10mb3AcX8RE3_LDChg@mail.gmail.com>
On Fri, Mar 16, 2018 at 8:38 AM, Jason Merrill <jason@redhat.com> wrote:
> On Thu, Mar 15, 2018 at 4:50 AM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On Wed, Mar 14, 2018 at 8:57 PM, Jason Merrill <jason@redhat.com> wrote:
>>> Ping
>>>
>>> On Fri, Mar 2, 2018 at 1:23 PM, Jason Merrill <jason@redhat.com> wrote:
>>>> As I mentioned in the PR, the problem here is that we're replacing a
>>>> constructor with a dispatcher function which doesn't look much like a
>>>> constructor. This patch adjusts make_dispatcher_decl to make it look
>>>> more like the functions it dispatches to, but other things are certain
>>>> to break for similar reasons down the road. A proper solution should
>>>> be more transparent, like thunks.
>>>>
>>>> Tested x86_64-pc-linux-gnu. Does this seem worth applying to fix the
>>>> regression?
>>
>> The patch looks reasonable to me, you probably know best whether
>> the cp/ parts are risky or not ;)
>>
>> So - OK from my POV.
>>
>> And yes, thunks may be a better representation for the dispatcher.
>
> It occurred to me that I could handle this more locally by deferring
> the function substitution until genericization time, so this is what
> I'm checking in:
...but now that we're in stage 1, it still seems sensible to have a
single way of checking whether something is a constructor.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit 656d038fe0cf78a2432a8c9a047edc93af6d5b23
Author: Jason Merrill <jason@redhat.com>
Date: Fri Mar 16 08:32:26 2018 -0400
* cp-tree.h (DECL_CONSTRUCTOR_P): Use DECL_CXX_CONSTRUCTOR_P.
(DECL_DESTRUCTOR_P): Use DECL_CXX_DESTRUCTOR_P.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 2df158c9ea6..a4e0099a249 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -2731,7 +2731,7 @@ struct GTY(()) lang_decl {
/* For FUNCTION_DECLs and TEMPLATE_DECLs: nonzero means that this function
is a constructor. */
#define DECL_CONSTRUCTOR_P(NODE) \
- IDENTIFIER_CTOR_P (DECL_NAME (NODE))
+ DECL_CXX_CONSTRUCTOR_P (STRIP_TEMPLATE (NODE))
/* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete
object. */
@@ -2760,7 +2760,7 @@ struct GTY(()) lang_decl {
/* Nonzero if NODE (a FUNCTION_DECL or TEMPLATE_DECL)
is a destructor. */
#define DECL_DESTRUCTOR_P(NODE) \
- IDENTIFIER_DTOR_P (DECL_NAME (NODE))
+ DECL_CXX_DESTRUCTOR_P (STRIP_TEMPLATE (NODE))
/* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the
specialized in-charge constructor, in-charge deleting constructor,