2016-07-01 Jakub Jelinek <jakub@redhat.com>
+ PR fortran/71687
+ * f95-lang.c (struct binding_level): Add reversed field.
+ (clear_binding_level): Adjust initializer.
+ (getdecls): If reversed is clear, set it and nreverse the names
+ chain before returning it.
+ (poplevel): Use getdecls.
+ * trans-decl.c (gfc_generate_function_code, gfc_process_block_locals):
+ Use nreverse to pushdecl decls in the declaration order.
+
PR fortran/71717
* trans-openmp.c (gfc_omp_privatize_by_reference): Return false
for GFC_DECL_ASSOCIATE_VAR_P with POINTER_TYPE.
tree blocks;
/* The binding level containing this one (the enclosing binding level). */
struct binding_level *level_chain;
+ /* True if nreverse has been already called on names; if false, names
+ are ordered from newest declaration to oldest one. */
+ bool reversed;
};
/* The binding level currently in effect. */
static GTY(()) struct binding_level *global_binding_level;
/* Binding level structures are initialized by copying this one. */
-static struct binding_level clear_binding_level = { NULL, NULL, NULL };
+static struct binding_level clear_binding_level = { NULL, NULL, NULL, false };
/* Return true if we are in the global binding level. */
tree
getdecls (void)
{
+ if (!current_binding_level->reversed)
+ {
+ current_binding_level->reversed = true;
+ current_binding_level->names = nreverse (current_binding_level->names);
+ }
return current_binding_level->names;
}
binding level that we are about to exit and which is returned by this
routine. */
tree block_node = NULL_TREE;
- tree decl_chain = current_binding_level->names;
+ tree decl_chain = getdecls ();
tree subblock_chain = current_binding_level->blocks;
tree subblock_node;
gfc_finish_block (&cleanup));
/* Add all the decls we created during processing. */
- decl = saved_function_decls;
+ decl = nreverse (saved_function_decls);
while (decl)
{
tree next;
if (flag_coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
generate_coarray_init (ns);
- decl = saved_local_decls;
+ decl = nreverse (saved_local_decls);
while (decl)
{
tree next;
+2016-07-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/71687
+ * gfortran.dg/gomp/pr71687.f90: New test.
+
2016-07-01 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* gcc.dg/const-float128-ped.c: Require __float128 effective