aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog16
-rw-r--r--gcc/fortran/trans-array.c8
-rw-r--r--gcc/fortran/trans-types.c2
3 files changed, 19 insertions, 7 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 1adf055..fed67a6 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,12 +1,20 @@
+2004-08-20 Paul Brook <paul@codesourcery.com>
+ Canqun Yang <canqun@nudt.edu.cn>
+
+ PR fortran/17077
+ * trans-array.c (gfc_conv_array_parameter): Pass correct pointer
+ for automatic arrays.
+ * trans-types.c (gfc_get_nodesc_array_type): Add comment.
+
2004-08-19 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
- (Port from g95)
+ (Port from g95)
- PR fortran/17074
+ PR fortran/17074
* match.c (match_simple_forall, match_simple_where): Forward-declare.
(gfc_match_if): Order statement list alphabetically, add WHERE and
- FORALL, remove double PAUSE.
+ FORALL, remove double PAUSE.
(gfc_match_simple_where, match_forall_header,
- gfc_match_simple_forall): New functions.
+ gfc_match_simple_forall): New functions.
(gfc_match_forall): Use match_forall_header.
2004-08-19 Paul Brook <paul@codesourcery.com>
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 3abb195..5299b4c 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -3762,10 +3762,12 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77)
if (!sym->attr.pointer && sym->as->type != AS_ASSUMED_SHAPE
&& !sym->attr.allocatable)
{
- if (!sym->attr.dummy)
- se->expr = gfc_build_addr_expr (NULL, tmp);
+ /* Some variables are declared directly, others are declard as
+ pointers and allocated on the heap. */
+ if (sym->attr.dummy || POINTER_TYPE_P (TREE_TYPE (tmp)))
+ se->expr = tmp;
else
- se->expr = tmp;
+ se->expr = gfc_build_addr_expr (NULL, tmp);
return;
}
if (sym->attr.allocatable)
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 2b4edfc..f8a0450 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -750,6 +750,8 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, int packed)
if (packed < 3 || !known_stride)
{
+ /* For dummy arrays and automatic (heap allocated) arrays we
+ want a pointer to the array. */
type = build_pointer_type (type);
GFC_ARRAY_TYPE_P (type) = 1;
TYPE_LANG_SPECIFIC (type) = TYPE_LANG_SPECIFIC (TREE_TYPE (type));