Hi,
Could a gatekeeper please review my fix for bug 593?
https://bugs.open64.net/show_bug.cgi?id=593
Here is the example for the failing case:
1. _Complex long double cd = 234.0L + 0x0.abcp-70L + 567.0Li +0x0defp-70Li;
2. void complexlongdouble_i_fv (int n, ...) {
3. __builtin_va_list ap;
4.__builtin_va_start (ap, n);
5. if (__builtin_va_arg (ap, _Complex long double) != cd)
6. abort ();
7.__builtin_va_end (ap); }
The IR that wgen generated for the condition at line 5 is as:
U8LDA 0 <2,2,ap> T<69,anon_ptr.,8>
U8U8ILOAD 8 T<9,.predef_U8,8> T<67,anon_ptr.,8>
MMILOAD -32 T<23,.predef_C10,16> T<98,anon_ptr.,8>
C10C10LDID 0 <1,77,cd> T<23,.predef_C10,16>
I4C10NE
This is not right. The correct IR should be like:
...
U8U8LDID 0 <2,4,_temp_.va_arg5> T<98,anon_ptr.,8>
C10C10ILOAD 0 T<23,.predef_C10,16> T<98,anon_ptr.,8>
C10C10LDID 0 <1,77,cd> T<23,.predef_C10,16>
I4C10NE
(where: _temp_.va_arg5 saves ap)
The problem turns out that (in wgen_expr.cxx) the GS_VA_ARG_EXPR handling
only considers MTYPE_C4, not MTYPE_C8 or MTYPE_C10. My fix is to include
them.
Thanks,
Min
Since my patch is simple, I just show it here, instead of attachment:
Index: wgen_expr.cxx
===================================================================
--- wgen_expr.cxx (revision 3335)
+++ wgen_expr.cxx (working copy)
@@ -9901,10 +9901,12 @@
wn = WN_CreateIload(OPR_ILOAD, Widen_Mtype (mtype), mtype, 0,
ty_idx, Make_Pointer_Type(ty_idx), wn);
}
- else if (mtype == MTYPE_C4) {
- wn = WGEN_x8664_va_arg(ap_wn, MTYPE_float(mtype), ty_idx,
FALSE);
- wn = WN_CreateIload(OPR_ILOAD, MTYPE_C4, MTYPE_C4, 0, ty_idx,
- Make_Pointer_Type(ty_idx), wn);
+ else if (MTYPE_is_complex(mtype)) {
+ Is_True((mtype == MTYPE_C4 || mtype == MTYPE_C8 || mtype ==
MTYPE_C10),
+ ("WGEN_Expand_Expr: unexpected complex type"));
+ wn = WGEN_x8664_va_arg(ap_wn, MTYPE_float(mtype), ty_idx, FALSE);
+ wn = WN_CreateIload(OPR_ILOAD, mtype, mtype, 0, ty_idx,
+ Make_Pointer_Type(ty_idx), wn);
}
else {
enum X86_64_PARM_CLASS classes[MAX_CLASSES];
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel