summaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-27 06:38:52 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-27 06:38:52 +0000
commit2db0b3527cdd32dc1bb494d18508dc4320a19f69 (patch)
treec7c3eab8c786f9630cce495ae3913a2d458e808d /gcc/fortran
parentd0986467397b442d06f2d63557bbc3548919d783 (diff)
downloadgcc-2db0b3527cdd32dc1bb494d18508dc4320a19f69.tar.gz
2009-10-27 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 153581 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@153582 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog16
-rw-r--r--gcc/fortran/module.c29
-rw-r--r--gcc/fortran/trans-openmp.c5
-rw-r--r--gcc/fortran/trans-stmt.c70
-rw-r--r--gcc/fortran/trans.c4
5 files changed, 58 insertions, 66 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index cf6c8cd2dcb..8c333d8ca18 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,19 @@
+2009-10-26 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/41714
+ * trans.c (gfc_trans_code): Remove call to
+ 'tree_annotate_all_with_location'. Location should already be set.
+ * trans-openmp.c (gfc_trans_omp_workshare): Ditto.
+ * trans-stmt.c (gfc_trans_allocate): Do correct data initialization for
+ CLASS variables with SOURCE tag, plus some cleanup.
+
+2009-10-24 Janus Weil <janus@gcc.gnu.org>
+ Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/41784
+ * module.c (load_derived_extensions): Skip symbols which are not being
+ loaded.
+
2009-10-24 Paul Thomas <pault@gcc.gnu.org>
PR fortran/41772
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 2112d3e82b1..b2ad6ecc477 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3994,6 +3994,14 @@ load_derived_extensions (void)
info = get_integer (symbol);
derived = info->u.rsym.sym;
+ /* This one is not being loaded. */
+ if (!info || !derived)
+ {
+ while (peek_atom () != ATOM_RPAREN)
+ skip_list ();
+ continue;
+ }
+
gcc_assert (derived->attr.flavor == FL_DERIVED);
if (derived->f2k_derived == NULL)
derived->f2k_derived = gfc_get_namespace (NULL, 0);
@@ -4008,16 +4016,19 @@ load_derived_extensions (void)
nuse = number_use_names (name, false);
j = 1;
p = find_use_name_n (name, &j, false);
- st = gfc_find_symtree (gfc_current_ns->sym_root, p);
- dt = st->n.sym;
- st = gfc_find_symtree (derived->f2k_derived->sym_root, name);
- if (st == NULL)
+ if (p)
{
- /* Only use the real name in f2k_derived to ensure a single
- symtree. */
- st = gfc_new_symtree (&derived->f2k_derived->sym_root, name);
- st->n.sym = dt;
- st->n.sym->refs++;
+ st = gfc_find_symtree (gfc_current_ns->sym_root, p);
+ dt = st->n.sym;
+ st = gfc_find_symtree (derived->f2k_derived->sym_root, name);
+ if (st == NULL)
+ {
+ /* Only use the real name in f2k_derived to ensure a single
+ symtree. */
+ st = gfc_new_symtree (&derived->f2k_derived->sym_root, name);
+ st->n.sym = dt;
+ st->n.sym->refs++;
+ }
}
mio_rparen ();
}
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 56534ccdd38..4d461cfa488 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -1641,11 +1641,6 @@ gfc_trans_omp_workshare (gfc_code *code, gfc_omp_clauses *clauses)
if (res != NULL_TREE && ! IS_EMPTY_STMT (res))
{
- if (TREE_CODE (res) == STATEMENT_LIST)
- tree_annotate_all_with_location (&res, input_location);
- else
- SET_EXPR_LOCATION (res, input_location);
-
if (prev_singleunit)
{
if (ompws_flags & OMPWS_CURR_SINGLEUNIT)
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 7dc7405c67f..9b2a6230853 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -3983,12 +3983,13 @@ gfc_trans_allocate (gfc_code * code)
tree stat;
tree pstat;
tree error_label;
+ tree memsz;
stmtblock_t block;
if (!code->ext.alloc.list)
return NULL_TREE;
- pstat = stat = error_label = tmp = NULL_TREE;
+ pstat = stat = error_label = tmp = memsz = NULL_TREE;
gfc_start_block (&block);
@@ -4032,19 +4033,19 @@ gfc_trans_allocate (gfc_code * code)
gfc_init_se (&se_sz, NULL);
gfc_conv_expr (&se_sz, sz);
gfc_free_expr (sz);
- tmp = se_sz.expr;
+ memsz = se_sz.expr;
}
else if (code->expr3 && code->expr3->ts.type != BT_CLASS)
- tmp = TYPE_SIZE_UNIT (gfc_typenode_for_spec (&code->expr3->ts));
+ memsz = TYPE_SIZE_UNIT (gfc_typenode_for_spec (&code->expr3->ts));
else if (code->ext.alloc.ts.type != BT_UNKNOWN)
- tmp = TYPE_SIZE_UNIT (gfc_typenode_for_spec (&code->ext.alloc.ts));
+ memsz = TYPE_SIZE_UNIT (gfc_typenode_for_spec (&code->ext.alloc.ts));
else
- tmp = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (se.expr)));
+ memsz = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (se.expr)));
- if (expr->ts.type == BT_CHARACTER && tmp == NULL_TREE)
- tmp = se.string_length;
+ if (expr->ts.type == BT_CHARACTER && memsz == NULL_TREE)
+ memsz = se.string_length;
- tmp = gfc_allocate_with_status (&se.pre, tmp, pstat);
+ tmp = gfc_allocate_with_status (&se.pre, memsz, pstat);
tmp = fold_build2 (MODIFY_EXPR, void_type_node, se.expr,
fold_convert (TREE_TYPE (se.expr), tmp));
gfc_add_expr_to_block (&se.pre, tmp);
@@ -4075,21 +4076,17 @@ gfc_trans_allocate (gfc_code * code)
if (code->expr3)
{
gfc_expr *rhs = gfc_copy_expr (code->expr3);
- if (rhs->ts.type == BT_CLASS)
+ if (al->expr->ts.type == BT_CLASS)
{
- gfc_se dst,src,len;
- gfc_expr *sz;
- gfc_add_component_ref (rhs, "$data");
- sz = gfc_copy_expr (code->expr3);
- gfc_add_component_ref (sz, "$size");
+ gfc_se dst,src;
+ if (rhs->ts.type == BT_CLASS)
+ gfc_add_component_ref (rhs, "$data");
gfc_init_se (&dst, NULL);
gfc_init_se (&src, NULL);
- gfc_init_se (&len, NULL);
gfc_conv_expr (&dst, expr);
gfc_conv_expr (&src, rhs);
- gfc_conv_expr (&len, sz);
- gfc_free_expr (sz);
- tmp = gfc_build_memcpy_call (dst.expr, src.expr, len.expr);
+ gfc_add_block_to_block (&block, &src.pre);
+ tmp = gfc_build_memcpy_call (dst.expr, src.expr, memsz);
}
else
tmp = gfc_trans_assignment (gfc_expr_to_initialize (expr),
@@ -4108,8 +4105,7 @@ gfc_trans_allocate (gfc_code * code)
gfc_conv_expr (&dst, expr);
gfc_conv_expr (&src, init_e);
gfc_add_block_to_block (&block, &src.pre);
- tmp = TYPE_SIZE_UNIT (gfc_typenode_for_spec (&code->ext.alloc.ts));
- tmp = gfc_build_memcpy_call (dst.expr, src.expr, tmp);
+ tmp = gfc_build_memcpy_call (dst.expr, src.expr, memsz);
gfc_add_expr_to_block (&block, tmp);
}
/* Add default initializer for those derived types that need them. */
@@ -4127,6 +4123,7 @@ gfc_trans_allocate (gfc_code * code)
if (expr->ts.type == BT_CLASS)
{
gfc_expr *lhs,*rhs;
+ gfc_se lse;
/* Initialize VINDEX for CLASS objects. */
lhs = gfc_expr_to_initialize (expr);
gfc_add_component_ref (lhs, "$vindex");
@@ -4158,36 +4155,11 @@ gfc_trans_allocate (gfc_code * code)
/* Initialize SIZE for CLASS objects. */
lhs = gfc_expr_to_initialize (expr);
gfc_add_component_ref (lhs, "$size");
- rhs = NULL;
- if (code->expr3 && code->expr3->ts.type == BT_CLASS)
- {
- /* Size must be determined at run time. */
- rhs = gfc_copy_expr (code->expr3);
- gfc_add_component_ref (rhs, "$size");
- tmp = gfc_trans_assignment (lhs, rhs, false);
- gfc_add_expr_to_block (&block, tmp);
- }
- else
- {
- /* Size is fixed at compile time. */
- gfc_typespec *ts;
- gfc_se lse;
- gfc_init_se (&lse, NULL);
- gfc_conv_expr (&lse, lhs);
- if (code->expr3)
- ts = &code->expr3->ts;
- else if (code->ext.alloc.ts.type == BT_DERIVED)
- ts = &code->ext.alloc.ts;
- else if (expr->ts.type == BT_CLASS)
- ts = &expr->ts.u.derived->components->ts;
- else
- ts = &expr->ts;
- tmp = TYPE_SIZE_UNIT (gfc_typenode_for_spec (ts));
- gfc_add_modify (&block, lse.expr,
- fold_convert (TREE_TYPE (lse.expr), tmp));
- }
+ gfc_init_se (&lse, NULL);
+ gfc_conv_expr (&lse, lhs);
+ gfc_add_modify (&block, lse.expr,
+ fold_convert (TREE_TYPE (lse.expr), memsz));
gfc_free_expr (lhs);
- gfc_free_expr (rhs);
}
}
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 22c3e076085..42d22388105 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -1281,9 +1281,7 @@ gfc_trans_code (gfc_code * code)
if (res != NULL_TREE && ! IS_EMPTY_STMT (res))
{
- if (TREE_CODE (res) == STATEMENT_LIST)
- tree_annotate_all_with_location (&res, input_location);
- else
+ if (TREE_CODE (res) != STATEMENT_LIST)
SET_EXPR_LOCATION (res, input_location);
/* Add the new statement to the block. */