re PR fortran/85599 (warn about short-circuiting of logical expressions for non-pure...
authorJanus Weil <janus@gcc.gnu.org>
Wed, 18 Jul 2018 18:31:59 +0000 (20:31 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Wed, 18 Jul 2018 18:31:59 +0000 (20:31 +0200)
commit6457b1f096d216ca742f8e1f2a93462ecb24b38d
treee42854bbf767584ce4c287893b494c6154cdea1c
parentc56e97274f164e704e7f13dfe53531ced3cb24ca
re PR fortran/85599 (warn about short-circuiting of logical expressions for non-pure functions)

2018-07-18  Janus Weil  <janus@gcc.gnu.org>
    Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/85599
* dump-parse-tree.c (show_attr): Add handling of implicit_pure.
* frontend-passes.c (do_warn_function_elimination): Do not warn for
pure functions.
* gfortran.h: Add prototypes for gfc_pure_function and
gfc_implicit_pure_function.
* gfortran.texi: Add chapter on evaluation of logical expressions.
* invoke.texi: Mention that -Wfunction-elimination is implied
by -Wextra.
* lang.opt: Make -Wextra imply -Wfunction-elimination.
* resolve.c (pure_function): Rename to gfc_pure_function.
(gfc_implicit_pure_function): New function.
(check_pure_function): Use it here.
(impure_function_callback): New function.
(resolve_operator): Call it via gfc_expr_walker.

2018-07-18  Janus Weil  <janus@gcc.gnu.org>

PR fortran/85599
* gfortran.dg/function_optimize_5.f90: Add option
'-faggressive-function-elimination' and update dg-warning clauses.
* gfortran.dg/short_circuiting.f90: New test.

Co-Authored-By: Thomas Koenig <tkoenig@gcc.gnu.org>
From-SVN: r262860
gcc/fortran/ChangeLog
gcc/fortran/dump-parse-tree.c
gcc/fortran/frontend-passes.c
gcc/fortran/gfortran.h
gcc/fortran/gfortran.texi
gcc/fortran/invoke.texi
gcc/fortran/lang.opt
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/function_optimize_5.f90
gcc/testsuite/gfortran.dg/short_circuiting.f90 [new file with mode: 0644]