aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans.c
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2010-02-14 08:28:50 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2010-02-14 08:28:50 +0000
commitbc51e7261200de6aa426185513de950e278ab51f (patch)
tree6a9abd645ffe346f04c5f9e2b9e35c9d59448034 /gcc/fortran/trans.c
parent89fdbef28dab9e7c56781b17cd50d6894d6f425e (diff)
downloadgcc-bc51e7261200de6aa426185513de950e278ab51f.zip
gcc-bc51e7261200de6aa426185513de950e278ab51f.tar.gz
gcc-bc51e7261200de6aa426185513de950e278ab51f.tar.bz2
re PR fortran/32382 (missed optimization in internal read)
2010-02-14 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/32382 * trans-stmt.h: Add prototype for gfc_trans_code_cond. Add tree cond to gfc_trans_do prototype. * trans-stmt.c (gfc_trans_simple_do): Add optional argument to pass in a loop exit condition. If exit condition is given, build the loop exit code, checking IO results of implied do loops in READ and WRITE. (gfc_trans_do): Likewise. * trans.c (trans_code): New static work function, previously gfc_trans_code. Passes exit condition to gfc_trans_do. (gfc_trans_code): Calls trans_code with NULL_TREE condition. (gfc_trans_code_cond): Calls trans_code with loop exit condition. * trans-io.c (build_dt): Build an exit condition to allow checking IO result status bits in the dtparm structure. Use this condition in call to gfc_trans_code_cond. From-SVN: r156755
Diffstat (limited to 'gcc/fortran/trans.c')
-rw-r--r--gcc/fortran/trans.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index a5bb641..535e639 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -1048,10 +1048,12 @@ gfc_set_backend_locus (locus * loc)
}
-/* Translate an executable statement. */
+/* Translate an executable statement. The tree cond is used by gfc_trans_do.
+ This static function is wrapped by gfc_trans_code_cond and
+ gfc_trans_code. */
-tree
-gfc_trans_code (gfc_code * code)
+static tree
+trans_code (gfc_code * code, tree cond)
{
stmtblock_t block;
tree res;
@@ -1172,7 +1174,7 @@ gfc_trans_code (gfc_code * code)
break;
case EXEC_DO:
- res = gfc_trans_do (code);
+ res = gfc_trans_do (code, cond);
break;
case EXEC_DO_WHILE:
@@ -1298,6 +1300,25 @@ gfc_trans_code (gfc_code * code)
}
+/* Translate an executable statement with condition, cond. The condition is
+ used by gfc_trans_do to test for IO result conditions inside implied
+ DO loops of READ and WRITE statements. See build_dt in trans-io.c. */
+
+tree
+gfc_trans_code_cond (gfc_code * code, tree cond)
+{
+ return trans_code (code, cond);
+}
+
+/* Translate an executable statement without condition. */
+
+tree
+gfc_trans_code (gfc_code * code)
+{
+ return trans_code (code, NULL_TREE);
+}
+
+
/* This function is called after a complete program unit has been parsed
and resolved. */