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] |
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.
Attachment:
parens.diff
Description: Binary data
Attachment:
parens_1.f90
Description: Binary data
Attachment:
parens_2.f90
Description: Binary data
Attachment:
parens_3.f90
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |