+2010-02-21 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/35259
+ * doc/invoke.texi (-fassociative-math): Document that this
+ option is automatically enabled for Fortran.
+
2010-02-20 David S. Miller <davem@davemloft.net>
* configure.ac: Test if linker and assembler properly support
and thus may not be used when ordered comparisons are required.
This option requires that both @option{-fno-signed-zeros} and
@option{-fno-trapping-math} be in effect. Moreover, it doesn't make
-much sense with @option{-frounding-math}.
+much sense with @option{-frounding-math}. For Fortran the option
+is automatically enabled when both @option{-fno-signed-zeros} and
+@option{-fno-trapping-math} are in effect.
The default is @option{-fno-associative-math}.
+2010-02-21 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/35259
+ * gfortran.h (gfc_option_t): New flag -fprotect-parens.
+ * lang.opt: Ditto.
+ * option.c (gfc_init_options,gfc_handle_option): Ditto.
+ * trans-expr.c (gfc_conv_expr_op): Use the flag.
+ * invoke.texi: Document new -fno-protect-parens flag.
+
2010-02-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/36932
char flag_init_character_value;
int flag_align_commons;
int flag_whole_file;
+ int flag_protect_parens;
int fpe;
int rtcheck;
-fpack-derived -frepack-arrays -fshort-enums -fexternal-blas @gol
-fblas-matmul-limit=@var{n} -frecursive -finit-local-zero @gol
-finit-integer=@var{n} -finit-real=@var{<zero|inf|-inf|nan|snan>} @gol
--finit-logical=@var{<true|false>} -finit-character=@var{n} -fno-align-commons}
+-finit-logical=@var{<true|false>} -finit-character=@var{n} @gol
+-fno-align-commons -fno-protect-parens}
@end table
@menu
same form of this option should be used for all files that share a COMMON block.
To avoid potential alignment issues in COMMON blocks, it is recommended to order
objects from largests to smallest.
+
+@item -fno-protect-parens
+@opindex @code{fno-protect-parens}
+@cindex re-association of parenthesed expressions
+By default the parentheses in expression are honored for all optimization
+levels such that the compiler does not do any re-association. Using
+@option{-fno-protect-parens} allows the compiler to reorder REAL and
+COMPLEX expressions to produce faster code. Note that for the re-association
+optimization @option{-fno-signed-zeros} and @option{-fno-trapping-math}
+need to be in effect.
@end table
@xref{Code Gen Options,,Options for Code Generation Conventions,
Fortran
; Documented in C
+fprotect-parens
+Fortran
+Protect parentheses in expressions
+
frange-check
Fortran
Enable range checking during compilation
gfc_option.flag_init_character = GFC_INIT_CHARACTER_OFF;
gfc_option.flag_init_character_value = (char)0;
gfc_option.flag_align_commons = 1;
+ gfc_option.flag_protect_parens = 1;
gfc_option.fpe = 0;
gfc_option.rtcheck = 0;
gfc_option.flag_align_commons = value;
break;
+ case OPT_fprotect_parens:
+ gfc_option.flag_protect_parens = value;
+ break;
+
case OPT_fcheck_:
gfc_handle_runtime_check_option (arg);
break;
switch (expr->value.op.op)
{
case INTRINSIC_PARENTHESES:
- if (expr->ts.type == BT_REAL
- || expr->ts.type == BT_COMPLEX)
+ if ((expr->ts.type == BT_REAL
+ || expr->ts.type == BT_COMPLEX)
+ && gfc_option.flag_protect_parens)
{
gfc_conv_unary_op (PAREN_EXPR, se, expr);
gcc_assert (FLOAT_TYPE_P (TREE_TYPE (se->expr)));
+2010-02-21 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/35259
+ * gfortran.dg/reassoc_5.f90: New test.
+
2010-02-20 Uros Bizjak <ubizjak@gmail.com>
PR target/43067
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O3 -ffast-math -fdump-tree-optimized -fno-protect-parens" }
+!
+! PR fortran/35259
+! Test for -fno-protect-parens
+!
+function test(b)
+ real a
+ a = (b + 5.) - 5.
+ test = a
+end
+
+! Test copied from reassoc_1.f90 which checked for -fprotect-parens (default),
+! and thus for the occurance of "5 - 5".
+!
+! We need an explicit +5 and -5, and an intermediate ((bla)) expression
+! (the reassoc barrier). Make use of "." matching lineends.
+! { dg-final { scan-tree-dump-times "\\\+ 5.*\\\)\\\).* - 5" 0 "optimized" } }
+! { dg-final { cleanup-tree-dump "optimized" } }