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
This commit is contained in:
Richard Guenther 2008-09-04 19:32:02 +00:00 committed by Richard Biener
parent a524985e06
commit 6e1b67b364
6 changed files with 19 additions and 5 deletions

View File

@ -1,3 +1,10 @@
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>
* PR fortran/37099

View File

@ -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)
{
tmp = gfc_conv_expr_present (sym);
ptr = build3 (COND_EXPR, TREE_TYPE (se->expr), tmp, ptr,
null_pointer_node);
ptr = build3 (COND_EXPR, TREE_TYPE (se->expr), tmp,
fold_convert (TREE_TYPE (se->expr), ptr),
fold_convert (TREE_TYPE (se->expr), null_pointer_node));
}
ptr = gfc_evaluate_now (ptr, &se->pre);

View File

@ -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));
/* 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);
se->expr = build_fold_addr_expr (tmp);
}

View File

@ -2918,7 +2918,8 @@ gfc_conv_intrinsic_merge (gfc_se * se, gfc_expr * expr)
se->string_length = len;
}
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));
}

View File

@ -1,3 +1,7 @@
2008-09-04 Richard Guenther <rguenther@suse.de>
* gfortran.dg/internal_pack_4.f90: Adjust pattern.
2008-09-04 Daniel Kraft <d@domob.eu>
PR fortran/37099

View File

@ -26,6 +26,6 @@ USE M1
CALL S2()
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 { cleanup-tree-dump "original" } }