From ad5dd90de05dba5f4db6bc4d1e355dab4e4a4696 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Thu, 9 Mar 2006 05:52:06 +0000 Subject: re PR fortran/26257 (internal compiler error: Segmentation fault, on function call with assumed shape array parameter) 2006-03-09 Paul Thomas PR fortran/26257 * trans-array.c (gfc_conv_expr_descriptor): Exclude calculation of the offset and data when se->data_not_needed is set. * trans.h: Include the data_not_need bit in gfc_se. * trans-intrinsic.c (gfc_conv_intrinsic_size): Set it for SIZE. 2006-03-09 Paul Thomas * PR fortran/26257 gfortran.dg/auto_char_len_3.f90: New test From-SVN: r111860 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/trans-array.c | 19 ++++++++++++------- gcc/fortran/trans-intrinsic.c | 1 + gcc/fortran/trans.h | 4 ++++ 4 files changed, 25 insertions(+), 7 deletions(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ba6886a..dc1cdea 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2006-03-09 Paul Thomas + + PR fortran/26257 + * trans-array.c (gfc_conv_expr_descriptor): Exclude calculation of + the offset and data when se->data_not_needed is set. + * trans.h: Include the data_not_need bit in gfc_se. + * trans-intrinsic.c (gfc_conv_intrinsic_size): Set it for SIZE. + 2006-03-06 Paul Thomas Erik Edelmann diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 9f5337b..a865d57 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -4172,14 +4172,19 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) dim++; } - /* Point the data pointer at the first element in the section. */ - tmp = gfc_conv_array_data (desc); - tmp = build_fold_indirect_ref (tmp); - tmp = gfc_build_array_ref (tmp, offset); - offset = gfc_build_addr_expr (gfc_array_dataptr_type (desc), tmp); - gfc_conv_descriptor_data_set (&loop.pre, parm, offset); + if (se->data_not_needed) + gfc_conv_descriptor_data_set (&loop.pre, parm, gfc_index_zero_node); + else + { + /* Point the data pointer at the first element in the section. */ + tmp = gfc_conv_array_data (desc); + tmp = build_fold_indirect_ref (tmp); + tmp = gfc_build_array_ref (tmp, offset); + offset = gfc_build_addr_expr (gfc_array_dataptr_type (desc), tmp); + gfc_conv_descriptor_data_set (&loop.pre, parm, offset); + } - if (se->direct_byref) + if (se->direct_byref && !se->data_not_needed) { /* Set the offset. */ tmp = gfc_conv_descriptor_offset (parm); diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 6ec0a51..c6a2313 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -2405,6 +2405,7 @@ gfc_conv_intrinsic_size (gfc_se * se, gfc_expr * expr) ss = gfc_walk_expr (actual->expr); gcc_assert (ss != gfc_ss_terminator); argse.want_pointer = 1; + argse.data_not_needed = 1; gfc_conv_expr_descriptor (&argse, actual->expr, ss); gfc_add_block_to_block (&se->pre, &argse.pre); gfc_add_block_to_block (&se->post, &argse.post); diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index e571df9..4955fe4 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -67,6 +67,10 @@ typedef struct gfc_se /* Ignore absent optional arguments. Used for some intrinsics. */ unsigned ignore_optional:1; + /* When this is set the data and offset fields of the returned descriptor + are NULL. Used by intrinsic size. */ + unsigned data_not_needed:1; + /* Scalarization parameters. */ struct gfc_se *parent; struct gfc_ss *ss; -- cgit v1.1