This patch looks fine to me.
2010/10/19 Chen, Rui (Roger, TSG-GDCC-SH) <rui.c...@hp.com>
> Hi all,
>
>
>
> Could gatekeeper help to review this fix?
>
>
>
> Throw exception statement in 3 operands conditional expression causes
> open64 assertion fault:
>
>
>
> Example:
>
> int foo();
>
>
>
> void bar() {
>
> int* i = foo() ? (int*) 0 : throw "?";
>
> }
>
>
>
> The error message is:
>
>
>
> ### Assertion failure at line 10317 of
> ../../../../open64_backup/osprey/wgen/wgen_expr.cxx:
>
> ### Compiler Error during Writing WHIRL file phase:
>
> ### WGEN_Expand_Expr: NULL WHIRL tree for GS_COND_EXPR
>
> openCC INTERNAL ERROR:
> /fc/home/chenr/workspace/open64_backup_build/binroot/lib/gcc-lib/x86_64-open64-linux/4.2/wgen42
> returned non-zero status 1
>
>
>
> I attached two test cases and the patch. Pls help to review it.
>
>
>
> Index: osprey/wgen/wgen_expr.cxx
>
> ===================================================================
>
> --- osprey/wgen/wgen_expr.cxx (revision 3375)
>
> +++ osprey/wgen/wgen_expr.cxx (working copy)
>
> @@ -7140,6 +7140,7 @@
>
> WN *then_block = WN_CreateBlock ();
>
> WN *else_block = WN_CreateBlock ();
>
> WN *if_stmt = WN_CreateIf (wn0, then_block, else_block);
>
> + WN *comma_value = NULL;
>
> #ifdef KEY
>
> SRCPOS if_stmt_srcpos = Get_Srcpos();
>
> // Bug 11937: Generate guard variables where necessary. (See
>
> @@ -7158,6 +7159,7 @@
>
> }
>
> gs_t guard_var1 = WGEN_Guard_Var_Pop();
>
> if (wn1 && !typed_ite) {
>
> + comma_value = wn1;
>
> wn1 = WN_CreateEval (wn1);
>
> WGEN_Stmt_Append (wn1, Get_Srcpos());
>
> }
>
> @@ -7177,6 +7179,7 @@
>
> wn2 = WGEN_Expand_Expr (gs_tree_operand(exp, 2), FALSE, 0, 0,
> 0, 0, FALSE, FALSE, target_wn);
>
> gs_t guard_var2 = WGEN_Guard_Var_Pop();
>
> if (wn2 && !typed_ite) {
>
> + comma_value = wn2;
>
> wn2 = WN_CreateEval (wn2);
>
> WGEN_Stmt_Append (wn2, Get_Srcpos());
>
> }
>
> @@ -7186,8 +7189,18 @@
>
> WGEN_add_guard_var(guard_var2, else_block, FALSE);
>
> }
>
> }
>
> - // Generate IF statement.
>
> - WGEN_Stmt_Append (if_stmt, if_stmt_srcpos);
>
> +
>
> + if (target_wn == NULL && TY_mtype(ty_idx) != MTYPE_V &&
>
> + (TY_mtype(ty_idx1) == MTYPE_V || (TY_mtype(ty_idx2) ==
> MTYPE_V))) {
>
> + WN* block = WN_CreateBlock();
>
> + WN_INSERT_BlockLast(block, if_stmt);
>
> + wn = WN_CreateComma(OPR_COMMA,
>
> + TY_mtype(ty_idx1) == MTYPE_V ? TY_mtype(ty_idx2) :
> TY_mtype(ty_idx1),
>
> + MTYPE_V, block, comma_value);
>
> + } else {
>
> + // Generate IF statement.
>
> + WGEN_Stmt_Append (if_stmt, if_stmt_srcpos);
>
> + }
>
> #else
>
> WGEN_Stmt_Append (if_stmt, Get_Srcpos());
>
> WGEN_Stmt_Push (then_block, wgen_stmk_if_then, Get_Srcpos());
>
>
>
>
>
> Regards,
>
> Roger
>
>
> ------------------------------------------------------------------------------
> Download new Adobe(R) Flash(R) Builder(TM) 4
> The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
> Flex(R) Builder(TM)) enable the development of rich applications that run
> across multiple browsers and platforms. Download your free trials today!
> http://p.sf.net/sfu/adobe-dev2dev
> _______________________________________________
> Open64-devel mailing list
> Open64-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/open64-devel
>
>
--
Regards,
Lai Jian-Xin
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel