This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [gfortran] Fix PRs 14771, 20894, 25048 : keep track of parentheses
- From: Erik Zeek <zeekec at mad dot scientist dot com>
- To: "Tobias dot Schlueter at physik dot uni-muenchen dot de" <Tobias dot Schlueter at physik dot uni-muenchen dot de>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, walt at fortran dot com
- Date: Fri, 10 Feb 2006 10:20:12 -0500
- Subject: Re: [gfortran] Fix PRs 14771, 20894, 25048 : keep track of parentheses
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=jQ08Gihsevqxc2xgGj/7IfcKTPmvJJYW7Cd60u6HEYBBwAZ6Ogvx/wsh53dJV5w4+hRncRGrtOt0c00nTAz6zajScuFbRIXdtkSy5yKJoepD1dBe1W1ZjJBxshNbBOOAKspI3aby8xWoXbelCvE6M1zxU3tfIGZBO7Jytebz/S8=
- References: <1139500451.43eb65a34ab0e@www.cip.physik.uni-muenchen.de>
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)
*******************************************