This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] Fix PRs 14771, 20894, 25048 : keep track of parentheses


On 2/9/06, Tobias.Schlueter@physik.uni-muenchen.de
<Tobias.Schlueter@physik.uni-muenchen.de> wrote:
>
> This is the patch I had originally sent to the g95 lists in October 2002,
> updated to our current tree.  It makes us keep track of parentheses around
> numerical expressions, and makes us reject a number of instances of wrong code
> (PR 20894, 25048), and the bug Walt Brainerd reported as fc107, where we got
> pass-by-value wrong.
>
> The patch itself is fairly straightforward: a new intrinsic operator
> (INTRINSIC_PARENTHESES) is added, a numerical expression is wrapped as operand
> to this operator, if it is found inside parentheses.  Then straightforward code
> for simplification and resolution is added, following the lines of the unary
> plus operator.  Finally expression translation is taught about the parentheses,
> and everything falls into its place, and the bugs are fixed.
>
> Built and tested on i686-pc-linux GNU, I'm seeing a regression with
> unf_io_convert_4.f90 with and without the patch, but other than that the
> testsuite run is clean.  ChangeLog below, patch and new testcases attached.  Ok
> for the trunk and 4.1?
>
> Regards,
> - Tobi
>
>         PR fortran/14771
>         * gfortran.h (gfc_intrinsic_op): Add INTRINSIC_PARENTHESES.
>         * dump-parse-tree (gfc_show_expr): Handle INTRINSIC_PARENTHESES.
>         * expr.c (simplify_intrinsic_op): Treat INTRINSIC_PARENTHESES as
>         if it were INTRINSIC_UPLUS.
>         * resolve.c (resolve_operator): Handle INTRINSIC_PARENTHESES.
>         * match.c (intrinsic_operators): Add INTRINSIC_PARENTHESES.
>         * matchexp.c (match_primary): Record parentheses surrounding
>         numeric expressions.
>         * module.c (intrinsics): Add INTRINSIC_PARENTHESES for module
>         dumping.
>         * trans-expr.c (gfc_conv_expr_op): Handle INTRINSIC_PARENTHESES.
>
>
>

This appears to cause the following to fail:

program test
    call bob(5)
contains
    subroutine bob(n)
        integer, intent(in) :: n
        character(len=n) :: temp1
        character(len=(n)) :: temp2 ! Fails here
    end subroutine bob
end program test

gfortran-CVS gf.F95
 In file gf.F95:7

        character(len=(n)) :: temp2
                     1
Error: Only intrinsic operators can be used in expression at (1)

--
*******************************************
Dr. Erik Zeek
Postdoctoral Research Associate
Department of Physics and Astronomy
The University of Georgia
Athens, GA 30602-2451

Tel: 706-542-7293
Email: mailto:zeekec@mad.scientist.com
Html:  http://www.physast.uga.edu/~zeekec
*******************************************
Against stupidity the very gods
Themselves contend in vain.
  - Johann Christoph Friedrich von Schiller (1801)
*******************************************

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]