[PATCH] fortran/45495 -- optional dummy args cannot not be in restricted expressions

H.J. Lu hjl.tools@gmail.com
Fri Sep 3 18:06:00 GMT 2010


On Thu, Sep 2, 2010 at 2:44 PM, Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
> A specification expression is an expression with limitations
> that make it suitable for use in specifications such as length
> type parameters (C501) and array bounds (R512, R513).
>
> R729  specification-expr          is   scalar-int-expr
>
> C710  (R729) The scalar-int-expr shall be a restricted expression.
>
> A restricted expression is an expression in which each operation
> is intrinsic and each primary is
> ...
>  (2)  An object designator with a base object that is a dummy
>       argument that has neither the OPTIONAL nor the INTENT(OUT)
>       attribute,
>
> The attach patch enforces the above restriction.  It has been
> built and regression tested on x86_64-*-freebsd.  OK for trunk?
>
>
> 2010-09-02  Steven G. Kargl  <kargl@gcc.gnu.org>
>
>        PR fortran/45495
>        * gfortran.dg/dummy_optional_arg.f90: New test.
>
> 2010-09-02  Steven G. Kargl  <kargl@gcc.gnu.org>
>
>        PR fortran/45495
>        * fortran/expr.c (check_inquiry): Optional dummy argument are not
>        permitted in a restricted expression.
>

The new test fails on Linux/x86:

/export/gnu/import/svn/gcc-test/src-trunk/gcc/testsuite/gfortran.dg/dummy_procedure_1.f90:39.10:^M
^M
  call s1(i) ! { dg-error "Expected a procedure for argument" }^M
          1^M
Error: Expected a procedure for argument 'f' at (1)^M
/export/gnu/import/svn/gcc-test/src-trunk/gcc/testsuite/gfortran.dg/dummy_procedure_1.f90:43.10:^M
^M
  call s1(z) ! { dg-error "Expected a procedure for argument" }^M
          1^M
Error: Expected a procedure for argument 'f' at (1)^M
/export/gnu/import/svn/gcc-test/src-trunk/gcc/testsuite/gfortran.dg/dummy_procedure_1.f90:44.10:^M
^M
  call s2(x) ! { dg-error "Invalid procedure argument" }^M
          1^M
Error: Invalid procedure argument at (1)^M

PASS: gfortran.dg/dummy_procedure_1.f90  -O   (test for errors, line 39)
FAIL: gfortran.dg/dummy_procedure_1.f90  -O   (test for errors, line 40)


-- 
H.J.



More information about the Fortran mailing list