[Fortran] Fix/modify present() handling for assumed-shape optional (PR 94672)
authorTobias Burnus <tobias@codesourcery.com>
Mon, 11 May 2020 14:39:20 +0000 (16:39 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Mon, 11 May 2020 14:40:18 +0000 (16:40 +0200)
commit892c7427ee234c04852e90d9ce32913a429adf9d
treefa62cc00f73ebbf6a0380d06175041a35bd3cffb
parentaa4317866bf3e9f42f3b8e3b1b1ec113ed1f818d
[Fortran] Fix/modify present() handling for assumed-shape optional (PR 94672)

gcc/fortran/
2020-05-07  Tobias Burnus  <tobias@codesourcery.com>

PR fortran/94672
* trans.h (gfc_conv_expr_present): Add use_saved_decl=false argument.
* trans-expr.c (gfc_conv_expr_present): Likewise; use DECL directly
and only if use_saved_decl is true, use the actual PARAM_DECL arg (saved
descriptor).
* trans-array.c (gfc_trans_dummy_array_bias): Set local 'arg.0'
variable to NULL if 'arg' is not present.
* trans-openmp.c (gfc_omp_check_optional_argument): Simplify by checking
'arg.0' instead of the true PARM_DECL.
(gfc_omp_finish_clause): Remove setting 'arg.0' to NULL.

gcc/testsuite/
2020-05-07  Jakub Jelinek  <jakub@redhat.com>
    Tobias Burnus  <tobias@codesourcery.com>

PR fortran/94672
* gfortran.dg/gomp/pr94672.f90: New.
* gfortran.dg/missing_optional_dummy_6a.f90: Update scan-tree.
gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/fortran/trans-expr.c
gcc/fortran/trans-openmp.c
gcc/fortran/trans.h
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/pr94672.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/missing_optional_dummy_6a.f90