This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/49418 (lost cv-quals on template parameter type)
- From: Kirill Yukhin <kirill dot yukhin at gmail dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 1 Jul 2011 09:36:48 +0400
- Subject: Re: C++ PATCH for c++/49418 (lost cv-quals on template parameter type)
- References: <4E00EAE6.8090709@redhat.com> <BANLkTikMP3YYrz5dxeFOKKvWe6jB+LbckA@mail.gmail.com> <4E03F401.7060106@redhat.com> <BANLkTinrbz2vMHOXUecMQ6JCF0Zun8PpkQ@mail.gmail.com> <BANLkTinu-r2F=3FOj3oZkW4CN6UzA7Zo+Q@mail.gmail.com>
Hi Jason,
I've had looked into the problem and I believe, that problem is
somehow connected to FE.
Moreover, it is really look like that it is connected to
array-to-pointer conversion.
I put lots of details in the bug:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49519
Here is very short description:
C++ code looks like this:
include/base/thread_management.h:
template <typename PFun, typename C, typename ArgList>
static inline void do_call (PFun fun_ptr,
C &obj,
ArgList &arg_list,
internal::return_value<RT> &ret_val,
const int2type<4> &)
{
ret_val.set ((obj.*fun_ptr) (arg_list.template get<0>(),
arg_list.template get<1>(),
arg_list.template get<2>(),
arg_list.template get<3>()));
While after "einline" phase it becomes:
[include/boost/tuple/detail/tuple_basic.hpp : 130:14] D.167199_17 =
MEM[(struct cons &)arg_list_2(D) + 12].head;
[include/boost/tuple/detail/tuple_basic.hpp : 130:14] D.167198_18 =
MEM[(struct cons &)arg_list_2(D) + 8].head;
[include/boost/tuple/detail/tuple_basic.hpp : 130:14] D.167197_19 =
MEM[(struct cons &)arg_list_2(D) + 4].head;
[step-14.cc : 4271:1] D.167196_20 = MEM[(struct cons &)arg_list_2(D)];
[include/base/thread_management.h : 1534:13] D.167205_21 =
(sizetype)fun_ptr$__delta_7;
[include/base/thread_management.h : 1534:13] D.167204_22 = obj_1(D)
+D.167205_21;
[include/base/thread_management.h : 1534:13] iftmp.53_23
(D.167204_22,D.167196_20, D.167197_19, D.167198_18, D.167199_17);
[include/base/thread_management.h : 1826:5] return;
Could you please prompt me if this is a correct code? I believe - not
Thanks, K
On Fri, Jun 24, 2011 at 8:23 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Jun 23, 2011 at 8:07 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Thu, Jun 23, 2011 at 7:18 PM, Jason Merrill <jason@redhat.com> wrote:
>>> On 06/23/2011 08:45 PM, H.J. Lu wrote:
>>>>
>>>> This caused:
>>>>
>>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49519
>>>
>>> I'm checking this in as an alternate fix. ?Testing hasn't completed yet, but
>>> I'm confident that this version is safe.
>>>
>>
>> I still got the same failure with revision 175368. ?The problem is caused by
>> the "While looking at this, I've also changed a few more TYPE_MAIN_VARIANTs
>> to cv_unqualified" change in
>>
>> http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01622.html
>
> Revert this patch:
>
> diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
> index 4d2caa8..2716f78 100644
> --- a/gcc/cp/pt.c
> +++ b/gcc/cp/pt.c
> @@ -10246,7 +10246,7 @@ tsubst_arg_types (tree arg_types,
>
> ? ? /* Do array-to-pointer, function-to-pointer conversion, and ignore
> ? ? ? ?top-level qualifiers as required. ?*/
> - ? ?type = TYPE_MAIN_VARIANT (type_decays_to (type));
> + ? ?type = cv_unqualified (type_decays_to (type));
>
> ? ? /* We do not substitute into default arguments here. ?The standard
> ? ? ? ?mandates that they be instantiated only when needed, which is
>
> seems to fix the crash.
>
> --
> H.J.
>