[C++ PATCH] Fix up DECL_ARG_TYPE (PR c++/36631)

Richard Guenther richard.guenther@gmail.com
Thu Nov 6 10:05:00 GMT 2008


On Thu, Nov 6, 2008 at 10:14 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Wed, Nov 05, 2008 at 07:51:23AM -0800, Mark Mitchell wrote:
>> Jakub Jelinek wrote:
>>
>> > The following patch has been bootstrapped/regtested on x86_64-linux.
>> >
>> > 2008-11-04  Jakub Jelinek  <jakub@redhat.com>
>> >
>> >     PR c++/36631
>> >     * cp-gimplify.c (cp_genericize_r): For FUNCTION_DECLs ensure
>> >     DECL_ARG_TYPE of all PARM_DECLs is correct.
>> >
>> >     * g++.dg/template/call5.C: New test.
>>
>> Why not just defer *all* computation of DECL_ARG_TYPE until converting
>> to generic?  I don't think the C++ front-end actually uses it, and I
>> don't think it should.
>
> Not all functions go through conversion to generic, nor are referenced by
> some function during genericization, say in
> struct A { A (); ~A (); };
> void foo (A, A, A);
> static void (*fnptr) (A, A, A) = foo;
> int main ()
> {
>  fnptr (A (), A(), A());
> }
> where would DECL_ARG_TYPE be set for foo?  Only during optimizations
> GCC figures out that fnptr is actually const (being static and never
> modified in the CU) and constant propagates it.

Can we do it from the gimplification langhook?

Richard.

>        Jakub
>



More information about the Gcc-patches mailing list