Commit 6e1b67b3 by Richard Guenther Committed by Richard Biener

trans-array.c (gfc_conv_array_parameter): Use correct types in building COND_EXPRs.

2008-09-04  Richard Guenther  <rguenther@suse.de>

	* trans-array.c (gfc_conv_array_parameter): Use correct types
	in building COND_EXPRs.
	* trans-expr.c (gfc_conv_missing_dummy): Likewise.
	* trans-intrinsics.c (gfc_conv_intrinsic_merge): Likewise.

	* gfortran.dg/internal_pack_4.f90: Adjust pattern.

From-SVN: r140001
parent a524985e
2008-09-04 Richard Guenther <rguenther@suse.de>
* trans-array.c (gfc_conv_array_parameter): Use correct types
in building COND_EXPRs.
* trans-expr.c (gfc_conv_missing_dummy): Likewise.
* trans-intrinsics.c (gfc_conv_intrinsic_merge): Likewise.
2008-09-04 Daniel Kraft <d@domob.eu> 2008-09-04 Daniel Kraft <d@domob.eu>
* PR fortran/37099 * PR fortran/37099
......
...@@ -5250,8 +5250,9 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77, ...@@ -5250,8 +5250,9 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77,
if (fsym && fsym->attr.optional && sym && sym->attr.optional) if (fsym && fsym->attr.optional && sym && sym->attr.optional)
{ {
tmp = gfc_conv_expr_present (sym); tmp = gfc_conv_expr_present (sym);
ptr = build3 (COND_EXPR, TREE_TYPE (se->expr), tmp, ptr, ptr = build3 (COND_EXPR, TREE_TYPE (se->expr), tmp,
null_pointer_node); fold_convert (TREE_TYPE (se->expr), ptr),
fold_convert (TREE_TYPE (se->expr), null_pointer_node));
} }
ptr = gfc_evaluate_now (ptr, &se->pre); ptr = gfc_evaluate_now (ptr, &se->pre);
......
...@@ -161,7 +161,8 @@ gfc_conv_missing_dummy (gfc_se * se, gfc_expr * arg, gfc_typespec ts, int kind) ...@@ -161,7 +161,8 @@ gfc_conv_missing_dummy (gfc_se * se, gfc_expr * arg, gfc_typespec ts, int kind)
tmp = fold_convert (tmp, build_fold_indirect_ref (se->expr)); tmp = fold_convert (tmp, build_fold_indirect_ref (se->expr));
/* Test for a NULL value. */ /* Test for a NULL value. */
tmp = build3 (COND_EXPR, TREE_TYPE (tmp), present, tmp, integer_one_node); tmp = build3 (COND_EXPR, TREE_TYPE (tmp), present, tmp,
fold_convert (TREE_TYPE (tmp), integer_one_node));
tmp = gfc_evaluate_now (tmp, &se->pre); tmp = gfc_evaluate_now (tmp, &se->pre);
se->expr = build_fold_addr_expr (tmp); se->expr = build_fold_addr_expr (tmp);
} }
......
...@@ -2918,7 +2918,8 @@ gfc_conv_intrinsic_merge (gfc_se * se, gfc_expr * expr) ...@@ -2918,7 +2918,8 @@ gfc_conv_intrinsic_merge (gfc_se * se, gfc_expr * expr)
se->string_length = len; se->string_length = len;
} }
type = TREE_TYPE (tsource); type = TREE_TYPE (tsource);
se->expr = fold_build3 (COND_EXPR, type, mask, tsource, fsource); se->expr = fold_build3 (COND_EXPR, type, mask, tsource,
fold_convert (type, fsource));
} }
......
2008-09-04 Richard Guenther <rguenther@suse.de>
* gfortran.dg/internal_pack_4.f90: Adjust pattern.
2008-09-04 Daniel Kraft <d@domob.eu> 2008-09-04 Daniel Kraft <d@domob.eu>
PR fortran/37099 PR fortran/37099
......
...@@ -26,6 +26,6 @@ USE M1 ...@@ -26,6 +26,6 @@ USE M1
CALL S2() CALL S2()
END END
! { dg-final { scan-tree-dump-times "a != 0B \\? _gfortran_internal_pack" 1 "original" } } ! { dg-final { scan-tree-dump-times "a != 0B \\? \\\(.*\\\) _gfortran_internal_pack" 1 "original" } }
! { dg-final { scan-tree-dump-times "if \\(a != 0B &&" 1 "original" } } ! { dg-final { scan-tree-dump-times "if \\(a != 0B &&" 1 "original" } }
! { dg-final { cleanup-tree-dump "original" } } ! { dg-final { cleanup-tree-dump "original" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment