This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/47650] wrong output of print_generic_decl() called from a plugin
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 15 Mar 2011 16:33:31 +0000
- Subject: [Bug middle-end/47650] wrong output of print_generic_decl() called from a plugin
- Auto-submitted: auto-generated
- References: <bug-47650-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47650
--- Comment #22 from rguenther at suse dot de <rguenther at suse dot de> 2011-03-15 16:33:09 UTC ---
On Tue, 15 Mar 2011, joe at mcknight dot de wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47650
>
> --- Comment #21 from joe at mcknight dot de 2011-03-15 16:18:37 UTC ---
> (In reply to comment #19)
> > All looks good to me with your C testcase:
> >
> > (gdb) call debug_generic_expr (fndecl->common.type)
> > int <T357> (struct
> > {
> > double dvar;
> > int ivar;
> > } *)
>
> Hm, the function was declared to take a new type "tpdefp", so I was expecting
> the dump to return it like this and not resolve it to whatever it is typedef'ed
> to.
>
> Compare it to:
>
> typedef int mytype;
> int myfunc2(mytype var) {
> return 1;
> };
>
> which outputs
>
> static int myfunc2 (mytype);
>
> i.e. returns the newly created type as well.
That's by design.
> > (gdb) call debug_generic_expr (fndecl->common.type)
> > void (*Handler) (int, void *) <T352> (void)
>
> It outputs "static void (*Handler) (int, void *) GetFunctionPointer (void);"
>
> And this is not C :-)
>
> The compiler throws a parse error when I compile a function with the prototype
> that it outputs.
It's not designed to do that. The functions are for debugging and
diagnostic output only, they are not supposed to generate valid C.
Richard.