diff options
author | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-24 09:26:43 +0000 |
---|---|---|
committer | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-24 09:26:43 +0000 |
commit | 92f4d1c4b0c37a968f88a966e56cb95a439e719c (patch) | |
tree | 4cd05ed6bf5ac4db7c4b5aa165da96b314bc23f5 /gcc/fortran/trans-intrinsic.c | |
parent | a68717dcf3130e47b2e1448347b16dd106ec4acb (diff) | |
download | gcc-92f4d1c4b0c37a968f88a966e56cb95a439e719c.tar.gz |
2008-07-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/29952
* gfortran.h: Add "warn_array_temp" to gfc_option_t.
* lang.opt: Add -Warray-temporaries.
* invoke.texi: Document -Warray-temporaries
* trans-array.h (gfc_trans_create_temp_array): Add argument of
type *locus.
(gfc_conv_loop_setup): Likewise.
* trans-array.c (gfc_trans_create_temp_array): If
-Warray-temporaries is given and locus is present, warn about
creation of array temporaries.
(gfc_trans_array_constructor_subarray): Add locus to call
of gfc_conv_loop_setup.
(gfc_trans_array_constructor): Add where argument. Pass where
argument to call of gfc_trans_create_temp_array.
(gfc_add_loop_ss_code): Add where argument. Pass where argument
to recursive call of gfc_add_loop_ss_code and to call of
gfc_trans_array_constructor.
(gfc_conv_loop_setup): Add where argument. Pass where argument
to calls to gfc_add_loop_ss_code and to gfc_trans_create_temp_array.
(gfc_conv_expr_descriptor): Pass location to call of
gfc_conv_loop_setup.
(gfc_conv_array_parameter): If -Warray-temporaries is given,
warn about creation of temporary arrays.
* trans-expr.c (gfc_conv_subref_array_arg): Add where argument
to call to gfc_conv_loop_setup.
(gfc_conv_function_call): Add where argument to call to
gfc_trans_creat_temp_array.
(gfc_trans_subarray_assign): Likewise.
(gfc_trans_assignment_1): Add where argument to call to
gfc_conv_loop_setup.
* trans-stmt.c (gfc_conv_elemental_dependencies): Add where
argument to call to gfc_trans_create_temp_array.
(gfc_trans_call): Add where argument to call to gfc_conv_loop_setup.
(generate_loop_for_temp_to_lhs): Likewise.
(generate_loop_for_rhs_to_temp): Likewise.
(compute_inner_temp_size): Likewise.
(gfc_trans-pointer_assign_need_temp): Likewise.
(gfc_evaluate_where_mask): Likewise.
(gfc_trans_where_assign): Likewise.
(gfc_trans_where_3): Likewise.
* trans-io.c (transfer_srray_component): Add where argument
to function. Add where argument to call to gfc_conv_loop_setup.
(transfer_expr): Add where argument to call to
transfer_array_component.
(gfc_trans_transfer): Add where expression to call to
gfc_conv_loop_setup.
* trans-intrinsic.c (gfc_conv_intrinsic_anyall): Add
where argument to call to gfc_conv_loop_setup.
(gfc_conv_intrinsic_count): Likewise.
(gfc_conv_intrinsic_arith): Likewise.
(gfc_conv_intrinsic_dot_product): Likewise.
(gfc_conv_intrinsic_minmaxloc): Likewise.
(gfc_conv_intrinsic_minmaxval): Likewise.
(gfc_conv_intrinsic_array_transfer): Warn about
creation of temporary array.
Add where argument to call to gfc_trans_create_temp_array.
* options.c (gfc_init_options): Initialize gfc_option.warn_array_temp.
(gfc_handle_option): Set gfc_option.warn_array_temp.
2008-07-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/29952
* gfortran.dg/array_temporaries_1.f90: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138112 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-intrinsic.c')
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 92bc0bb6d51..b76dd76ce9c 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -1731,7 +1731,7 @@ gfc_conv_intrinsic_anyall (gfc_se * se, gfc_expr * expr, int op) /* Initialize the loop. */ gfc_conv_ss_startstride (&loop); - gfc_conv_loop_setup (&loop); + gfc_conv_loop_setup (&loop, &expr->where); gfc_mark_ss_chain_used (arrayss, 1); /* Generate the loop body. */ @@ -1813,7 +1813,7 @@ gfc_conv_intrinsic_count (gfc_se * se, gfc_expr * expr) /* Initialize the loop. */ gfc_conv_ss_startstride (&loop); - gfc_conv_loop_setup (&loop); + gfc_conv_loop_setup (&loop, &expr->where); gfc_mark_ss_chain_used (arrayss, 1); /* Generate the loop body. */ @@ -1901,7 +1901,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, int op) /* Initialize the loop. */ gfc_conv_ss_startstride (&loop); - gfc_conv_loop_setup (&loop); + gfc_conv_loop_setup (&loop, &expr->where); gfc_mark_ss_chain_used (arrayss, 1); if (maskss) @@ -2019,7 +2019,7 @@ gfc_conv_intrinsic_dot_product (gfc_se * se, gfc_expr * expr) /* Initialize the loop. */ gfc_conv_ss_startstride (&loop); - gfc_conv_loop_setup (&loop); + gfc_conv_loop_setup (&loop, &expr->where); gfc_mark_ss_chain_used (arrayss1, 1); gfc_mark_ss_chain_used (arrayss2, 1); @@ -2159,7 +2159,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) /* Initialize the loop. */ gfc_conv_ss_startstride (&loop); - gfc_conv_loop_setup (&loop); + gfc_conv_loop_setup (&loop, &expr->where); gcc_assert (loop.dimen == 1); @@ -2355,7 +2355,7 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, int op) /* Initialize the loop. */ gfc_conv_ss_startstride (&loop); - gfc_conv_loop_setup (&loop); + gfc_conv_loop_setup (&loop, &expr->where); gfc_mark_ss_chain_used (arrayss, 1); if (maskss) @@ -3434,6 +3434,10 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) && arg->expr->ref->u.ar.type == AR_FULL)) { tmp = build_fold_addr_expr (argse.expr); + + if (gfc_option.warn_array_temp) + gfc_warning ("Creating array temporary at %L", &expr->where); + source = build_call_expr (gfor_fndecl_in_pack, 1, tmp); source = gfc_evaluate_now (source, &argse.pre); @@ -3587,7 +3591,8 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) FIXME callee_alloc is not set! */ gfc_trans_create_temp_array (&se->pre, &se->post, se->loop, - info, mold_type, false, true, false); + info, mold_type, false, true, false, + &expr->where); /* Cast the pointer to the result. */ tmp = gfc_conv_descriptor_data_get (info->descriptor); |