https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71687
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Sat Jul 2 10:25:52 2016 New Revision: 237944 URL: https://gcc.gnu.org/viewcvs?rev=237944&root=gcc&view=rev Log: Backported from mainline 2016-07-01 Jakub Jelinek <ja...@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. * gfortran.dg/gomp/pr71687.f90: New test. Added: branches/gcc-6-branch/gcc/testsuite/gfortran.dg/gomp/pr71687.f90 Modified: branches/gcc-6-branch/gcc/fortran/ChangeLog branches/gcc-6-branch/gcc/fortran/f95-lang.c branches/gcc-6-branch/gcc/fortran/trans-decl.c branches/gcc-6-branch/gcc/testsuite/ChangeLog