public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35259]  New: PAREN_EXPR: Option to allow for reassociation
@ 2008-02-20  9:28 burnus at gcc dot gnu dot org
  2008-02-20 10:10 ` [Bug fortran/35259] " rguenth at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-02-20  9:28 UTC (permalink / raw)
  To: gcc-bugs

Follow up to http://gcc.gnu.org/ml/fortran/2008-02/msg00157.html

Contrary to C, Fortran allows a lot of reassociations (-fassociative-math is
enabled by default in Fortran. THE GCC MANPAGE NEEDS TO BE UPDATED!).

Contrary to C with -fassociative-math, parentheses are still honoured, i.e. "(x
+ 2**52) - 2**52)" remains such while "x + 2**52 - 2**52" can be optimized to
"x".

In C the "= x" happens for both versions using -ffast-math. However, in Fortran
it never is done. We should add an option to do so optionally. One could argue
that option should be enabled by default for -ffast-math.


-- 
           Summary: PAREN_EXPR: Option to allow for reassociation
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35259


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/35259] PAREN_EXPR: Option to allow for reassociation
  2008-02-20  9:28 [Bug fortran/35259] New: PAREN_EXPR: Option to allow for reassociation burnus at gcc dot gnu dot org
@ 2008-02-20 10:10 ` rguenth at gcc dot gnu dot org
  2008-02-20 10:12 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-02-20 10:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2008-02-20 10:09 -------
Note that -fassociative-math is only enabled if -fno-signed-zeros and
-fno-trapping-math is specified.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-02-20 10:09:47
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35259


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/35259] PAREN_EXPR: Option to allow for reassociation
  2008-02-20  9:28 [Bug fortran/35259] New: PAREN_EXPR: Option to allow for reassociation burnus at gcc dot gnu dot org
  2008-02-20 10:10 ` [Bug fortran/35259] " rguenth at gcc dot gnu dot org
@ 2008-02-20 10:12 ` rguenth at gcc dot gnu dot org
  2008-02-20 10:23 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-02-20 10:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-02-20 10:12 -------
So - should Fortran disable flag_trapping_math and flag_signed_zeros by default
as well?  


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35259


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/35259] PAREN_EXPR: Option to allow for reassociation
  2008-02-20  9:28 [Bug fortran/35259] New: PAREN_EXPR: Option to allow for reassociation burnus at gcc dot gnu dot org
  2008-02-20 10:10 ` [Bug fortran/35259] " rguenth at gcc dot gnu dot org
  2008-02-20 10:12 ` rguenth at gcc dot gnu dot org
@ 2008-02-20 10:23 ` burnus at gcc dot gnu dot org
  2008-02-20 10:50 ` rguenther at suse dot de
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-02-20 10:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2008-02-20 10:23 -------
> So - should Fortran disable flag_trapping_math and flag_signed_zeros by default
> as well?

Ups, missed that. No, with Fortran 2003's IEEE support we need it at some
point.

The question is when the option should be set, when it should be stricter (for
trapping math and signed zero) and when looser (allow to ignore the
parentheses) and what new option we need for this.
Additionally, one also needs to put that somehow into the manpage :-/


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35259


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/35259] PAREN_EXPR: Option to allow for reassociation
  2008-02-20  9:28 [Bug fortran/35259] New: PAREN_EXPR: Option to allow for reassociation burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-02-20 10:23 ` burnus at gcc dot gnu dot org
@ 2008-02-20 10:50 ` rguenther at suse dot de
  2008-02-21  9:57 ` [Bug fortran/35259] -fassociative-math not enabled by default; No option to associate with PAREN_EXPRs rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenther at suse dot de @ 2008-02-20 10:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenther at suse dot de  2008-02-20 10:49 -------
Subject: Re:  PAREN_EXPR: Option to allow for reassociation

On Wed, 20 Feb 2008, burnus at gcc dot gnu dot org wrote:

> > So - should Fortran disable flag_trapping_math and flag_signed_zeros by default
> > as well?
> 
> Ups, missed that. No, with Fortran 2003's IEEE support we need it at some
> point.
> 
> The question is when the option should be set, when it should be stricter (for
> trapping math and signed zero) and when looser (allow to ignore the
> parentheses) and what new option we need for this.
> Additionally, one also needs to put that somehow into the manpage :-/

I think it would be useful to have Fortran specific options to
enable/disable sets of these options together.

Richard.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35259


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/35259] -fassociative-math not enabled by default;  No option to associate with PAREN_EXPRs
  2008-02-20  9:28 [Bug fortran/35259] New: PAREN_EXPR: Option to allow for reassociation burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-02-20 10:50 ` rguenther at suse dot de
@ 2008-02-21  9:57 ` rguenth at gcc dot gnu dot org
  2010-02-21 13:06 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-02-21  9:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2008-02-21 09:56 -------
Summary slightly changed.  There are two issues now:

 - We still do not allow re-association by default, even if we would honor
   PAREN_EXPR

 - There is no way to allow re-association in the face of PAREN_EXPR


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
            Summary|PAREN_EXPR: Option to allow |-fassociative-math not
                   |for reassociation           |enabled by default;  No
                   |                            |option to associate with
                   |                            |PAREN_EXPRs
            Version|4.3.0                       |4.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35259


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/35259] -fassociative-math not enabled by default;  No option to associate with PAREN_EXPRs
  2008-02-20  9:28 [Bug fortran/35259] New: PAREN_EXPR: Option to allow for reassociation burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-02-21  9:57 ` [Bug fortran/35259] -fassociative-math not enabled by default; No option to associate with PAREN_EXPRs rguenth at gcc dot gnu dot org
@ 2010-02-21 13:06 ` burnus at gcc dot gnu dot org
  2010-02-21 13:06 ` burnus at gcc dot gnu dot org
  2010-02-23 13:56 ` hjl dot tools at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-02-21 13:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from burnus at gcc dot gnu dot org  2010-02-21 13:06 -------
FIXED on the (4.5) trunk.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35259


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/35259] -fassociative-math not enabled by default;  No option to associate with PAREN_EXPRs
  2008-02-20  9:28 [Bug fortran/35259] New: PAREN_EXPR: Option to allow for reassociation burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-02-21 13:06 ` burnus at gcc dot gnu dot org
@ 2010-02-21 13:06 ` burnus at gcc dot gnu dot org
  2010-02-23 13:56 ` hjl dot tools at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-02-21 13:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from burnus at gcc dot gnu dot org  2010-02-21 13:06 -------
Subject: Bug 35259

Author: burnus
Date: Sun Feb 21 13:06:07 2010
New Revision: 156937

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156937
Log:
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-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-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/35259
        * gfortran.dg/reassoc_5.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/reassoc_5.f90
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/doc/invoke.texi
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/invoke.texi
    trunk/gcc/fortran/lang.opt
    trunk/gcc/fortran/options.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35259


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/35259] -fassociative-math not enabled by default;  No option to associate with PAREN_EXPRs
  2008-02-20  9:28 [Bug fortran/35259] New: PAREN_EXPR: Option to allow for reassociation burnus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2010-02-21 13:06 ` burnus at gcc dot gnu dot org
@ 2010-02-23 13:56 ` hjl dot tools at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-02-23 13:56 UTC (permalink / raw)
  To: gcc-bugs



-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35259


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-02-23 13:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-20  9:28 [Bug fortran/35259] New: PAREN_EXPR: Option to allow for reassociation burnus at gcc dot gnu dot org
2008-02-20 10:10 ` [Bug fortran/35259] " rguenth at gcc dot gnu dot org
2008-02-20 10:12 ` rguenth at gcc dot gnu dot org
2008-02-20 10:23 ` burnus at gcc dot gnu dot org
2008-02-20 10:50 ` rguenther at suse dot de
2008-02-21  9:57 ` [Bug fortran/35259] -fassociative-math not enabled by default; No option to associate with PAREN_EXPRs rguenth at gcc dot gnu dot org
2010-02-21 13:06 ` burnus at gcc dot gnu dot org
2010-02-21 13:06 ` burnus at gcc dot gnu dot org
2010-02-23 13:56 ` hjl dot tools at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).