This is the mail archive of the
mailing list for the GCC project.
Re: C++ bug with PCC_STATIC_STRUCT_RETURN
- To: gcc at gcc dot gnu dot org
- Subject: Re: C++ bug with PCC_STATIC_STRUCT_RETURN
- From: msokolov at ivan dot Harhan dot ORG (Michael Sokolov)
- Date: Mon, 29 Jan 01 22:14:06 PST
> I think I have found a bug in the C++ front end in the code #ifdefed on
> PCC_STATIC_STRUCT_RETURN and thus used only on the great old holy original
> ports (VAX, m68k, etc.) but not on any of the "modern" ones.
> This fragment in cp/semantics.c:
> #ifdef PCC_STATIC_STRUCT_RETURN
> if (!AGGR_INIT_VIA_CTOR_P (aggr_init_expr) && aggregate_value_p (type))
> int old_ac;
> flag_access_control = 0;
> call_expr = build_aggr_init (slot, call_expr, LOOKUP_ONLYCONVERTING);
> flag_access_control = old_ac;
> copy_from_buffer_p = 1;
> throws cc1plus into an infinite recursion of walk_tree when compiling a call to
> a function returning a structure.
OK, I have investigated it further, and here is what I found. The C++ front end
initially builds an AGGR_INIT_EXPR for every call to a function returning a
structure. Then expand_body calls simplify_aggr_init_exprs_r via walk_tree to
convert all AGGR_INIT_EXPRs into CALL_EXPRs. simplify_aggr_init_exprs_r
contains the code fragment quoted above ifdefed on PCC_STATIC_STRUCT_RETURN.
There it calls build_aggr_init to copy the struct return value from the callee-
returned static buffer into its temporary. Apparently, however, build_aggr_init
generates an AGGR_INIT_EXPR again, causing infinite recursion.
This is the point where I give up. I have no idea how to fix this. Unless a
volunteer shows up who groks the C++ front end and cares about
PCC_STATIC_STRUCT_RETURN systems, C++ will remain completely broken on VAX
4.3BSD, as well as m68k UNIXes with native PCC and all other targets that
Public Service Agent
International Engineering and Science Task Force
1351 VINE AVE APT 27 Phone: +1-714-738-5409
FULLERTON CA 92833-4291 USA (home office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP)