diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2011-04-04 20:22:21 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2011-04-04 20:22:21 +0000 |
commit | 128e09f93d6fa5fc367ad2be059c6dd674ef1049 (patch) | |
tree | 58f550f5722fb6ab76045f077f43698d59c89d4c /gcc/fortran/frontend-passes.c | |
parent | e5b0e1cab42d2b6e364e856dcdade434b8241c17 (diff) | |
download | gcc-128e09f93d6fa5fc367ad2be059c6dd674ef1049.zip gcc-128e09f93d6fa5fc367ad2be059c6dd674ef1049.tar.gz gcc-128e09f93d6fa5fc367ad2be059c6dd674ef1049.tar.bz2 |
re PR fortran/48412 (CP2K miscompiled due to some Fortran frontend pass)
2011-04-04 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/48412
* frontend-passes (cfe_expr_0): Reverse the order of going
through the loops.
2011-04-04 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/48412
* function_optimize_4.f90: New test.
From-SVN: r171952
Diffstat (limited to 'gcc/fortran/frontend-passes.c')
-rw-r--r-- | gcc/fortran/frontend-passes.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 755bae0..c2f6bd5 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -295,16 +295,16 @@ cfe_expr_0 (gfc_expr **e, int *walk_subtrees, gfc_expr_walker (e, cfe_register_funcs, NULL); - /* Walk backwards through all the functions to make sure we - catch the leaf functions first. */ - for (i=expr_count-1; i>=1; i--) + /* Walk through all the functions. */ + + for (i=1; i<expr_count; i++) { /* Skip if the function has been replaced by a variable already. */ if ((*(expr_array[i]))->expr_type == EXPR_VARIABLE) continue; newvar = NULL; - for (j=i-1; j>=0; j--) + for (j=0; j<i; j++) { if (gfc_dep_compare_functions(*(expr_array[i]), *(expr_array[j]), true) == 0) |