Hi all,
Can gatekeeper help review this fix?
Bug link: https://bugs.open64.net/show_bug.cgi?id=649
A small case:
1 namespace pcrecpp {
2 class Arg { public: Arg(); Arg(void*); };
3 class RE { static Arg no_arg; };
4 Arg RE::no_arg((void*)__null);
5 extern Arg no_arg __attribute__((alias("" "_ZN7pcrecpp2RE6no_argE")));
6 }
The wn for line5 is:
U8U8LDID 0 <1,52,_ZN7pcrecpp2RE6no_argE> T<54,Arg,1>
it uses the base st(_ZN7pcrecpp2RE6no_argE) instead of _ZN7pcrecpp6no_argE
I think the right one should be like this:
U8LDA 0 <1,54,_ZN7pcrecpp6no_argE> T<55,anon_ptr.,8>
The ori code did not consider the alias situation.
Here is the patch:
Index: wgen_expr.cxx
===================================================================
--- wgen_expr.cxx (revision 3426)
+++ wgen_expr.cxx (working copy)
@@ -2605,6 +2605,7 @@
case GS_FUNCTION_DECL:
{
st = Get_ST (arg0);
+ ST *real_st = gs_decl_alias_target(arg0)?
Get_ST(gs_decl_alias_target(arg0)):st;
ty_idx = ST_type (st);
#ifdef KEY
// Arg0 is the virtual function table (vtable) for a class.
Initialize
@@ -2632,7 +2633,7 @@
#endif
// for VLAs, use the base_st instead of st
if (code0 == GS_VAR_DECL &&
- st != ST_base(st)) {
+ real_st != ST_base(st)) {
FmtAssert (ST_ofst (st) == 0,
("Variable Length Arrays within struct not currently
implemented"));
wn = WN_Ldid (Pointer_Mtype, 0, ST_base(st), ST_type(ST_base(st)));
Thanks,
zhuqing
------------------------------------------------------------------------------
This SF Dev2Dev email is sponsored by:
WikiLeaks The End of the Free Internet
http://p.sf.net/sfu/therealnews-com
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel