Author: minz
Date: 2010-09-20 12:33:11 -0400 (Mon, 20 Sep 2010)
New Revision: 3347
Modified:
trunk/osprey/wgen/wgen_spin_symbol.cxx
trunk/osprey/wgen/wgen_stmt.cxx
Log:
Fix for bug 611:
The reason for the assertion is that gcc FE treats returning "complex double"
as return_in_memory and performs nrv (named return value) opt in -m32 mode.
While, wgen not treat any complex type as return_in_memroy.
The fix is to set complex type whose tsize larger than 12 to be
return_in_memory in -m32 mode (according to gcc FE convention).
Two assertions are also changed to include complex type as one possibile
return_in_memory type.
Code Review: Jian-Xin Lai
Modified: trunk/osprey/wgen/wgen_spin_symbol.cxx
===================================================================
--- trunk/osprey/wgen/wgen_spin_symbol.cxx 2010-09-20 03:32:03 UTC (rev
3346)
+++ trunk/osprey/wgen/wgen_spin_symbol.cxx 2010-09-20 16:33:11 UTC (rev
3347)
@@ -606,6 +606,10 @@
default: FmtAssert(FALSE, ("Get_TY unexpected size"));
}
idx = MTYPE_To_TY (mtype); // use predefined type
+ // gcc FE will set the complex type with size larger than 12 to be
+ // return_in_memory in m32 mode (e.g., gcc/config/i386/i386.c)
+ if (!TARGET_64BIT && tsize > 12)
+ Set_TY_return_in_mem(idx);
break;
case GS_POINTER_TYPE:
if (gs_type_ptrmem_p(type_tree)) {
Modified: trunk/osprey/wgen/wgen_stmt.cxx
===================================================================
--- trunk/osprey/wgen/wgen_stmt.cxx 2010-09-20 03:32:03 UTC (rev 3346)
+++ trunk/osprey/wgen/wgen_stmt.cxx 2010-09-20 16:33:11 UTC (rev 3347)
@@ -2326,8 +2326,9 @@
// object is created by a TARGET_EXPR, have the TARGET_EXPR write directly
// to the memory return area.
if (TY_return_in_mem(ret_ty_idx)) {
- FmtAssert (TY_mtype (ret_ty_idx) == MTYPE_M,
- ("WGEN_Expand_Return: return_in_mem type is not MTYPE_M"));
+ FmtAssert (TY_mtype (ret_ty_idx) == MTYPE_M ||
+ !TARGET_64BIT && MTYPE_is_complex(TY_mtype(ret_ty_idx)) && TY_mtype
(ret_ty_idx) != MTYPE_C4,
+ ("WGEN_Expand_Return: return_in_mem type is not MTYPE_M or
complex type"));
// Skip the NOP_EXPRs, if any, before the TARGET_EXPR. Bug 3448.
gs_t t = retval;
while (gs_tree_code(t) == GS_NOP_EXPR) {
@@ -2498,8 +2499,9 @@
// Copy the return value into the return area. Based on code in
// lower_return_val().
- FmtAssert (TY_mtype (ret_ty_idx) == MTYPE_M,
- ("WGEN_Expand_Return: return_in_mem type is not MTYPE_M"));
+ FmtAssert (TY_mtype (ret_ty_idx) == MTYPE_M ||
+ !TARGET_64BIT && MTYPE_is_complex(TY_mtype(ret_ty_idx)) && TY_mtype
(ret_ty_idx) != MTYPE_C4,
+ ("WGEN_Expand_Return: return_in_mem type is not MTYPE_M or
complex type"));
WN *first_formal = WN_formal(Current_Entry_WN(), 0);
TY_IDX tidx = ST_type(WN_st(first_formal));
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel