public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45318]  New: Do more parenthesis simplification with -fno-protect-parens
@ 2010-08-18 13:56 burnus at gcc dot gnu dot org
  2010-08-18 14:23 ` [Bug fortran/45318] " rguenth at gcc dot gnu dot org
  2010-08-18 17:44 ` burnus at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-08-18 13:56 UTC (permalink / raw)
  To: gcc-bugs

Fortran preserves () in expressions - in many cases, it shouldn't need to do so
if 
-fno-protect-parens is specified. The option currently affects only the middle
end, but there might be some cases where it is preserved without needing to be.
(Though, I might be wrong and everything is already properly simplified).

Note: The out most parenthesis can not always be removed without changing the
semantics, e.g.

  call copy ( (a), a)
contains
  subroutine copy (x, y)
    intent(in) :: x
    intent(out) :: y
is valid but only works if the "(a)" [-> temporary] is not optimized to "a".

In some cases, one might need to check for the unsave_math_optimization flag
before changing, e.g., "2+(a-2)" to "a" - or rather "(a)".


-- 
           Summary: Do more parenthesis simplification with -fno-protect-
                    parens
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          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=45318


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

* [Bug fortran/45318] Do more parenthesis simplification with -fno-protect-parens
  2010-08-18 13:56 [Bug fortran/45318] New: Do more parenthesis simplification with -fno-protect-parens burnus at gcc dot gnu dot org
@ 2010-08-18 14:23 ` rguenth at gcc dot gnu dot org
  2010-08-18 17:44 ` burnus at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-08-18 14:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-08-18 14:23 -------
(In reply to comment #0)
> In some cases, one might need to check for the unsave_math_optimization flag
> before changing, e.g., "2+(a-2)" to "a" - or rather "(a)".

The whole point of PAREN_EXPR in the middle-end is to avoid transforming
2 + (a - 2) even _with_ -funsafe-math-optimizations / -ffast-math!


-- 


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


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

* [Bug fortran/45318] Do more parenthesis simplification with -fno-protect-parens
  2010-08-18 13:56 [Bug fortran/45318] New: Do more parenthesis simplification with -fno-protect-parens burnus at gcc dot gnu dot org
  2010-08-18 14:23 ` [Bug fortran/45318] " rguenth at gcc dot gnu dot org
@ 2010-08-18 17:44 ` burnus at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-08-18 17:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2010-08-18 17:44 -------
(In reply to comment #1)
> (In reply to comment #0)
> > In some cases, one might need to check for the unsave_math_optimization flag
> > before changing, e.g., "2+(a-2)" to "a" - or rather "(a)".
> 
> The whole point of PAREN_EXPR in the middle-end is to avoid transforming
> 2 + (a - 2) even _with_ -funsafe-math-optimizations / -ffast-math!

Well, I am talking about FE optimizations with -fno-protect-parens (note the
"no-"). The PAREN_EXPR protection *is* and *should* one done with
-fprotect-parens (which is the default setting).

In terms of the middle end, -fno-protect-parens and -fprotect-parens are both
properly handled.


-- 


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


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

end of thread, other threads:[~2010-08-18 17:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-18 13:56 [Bug fortran/45318] New: Do more parenthesis simplification with -fno-protect-parens burnus at gcc dot gnu dot org
2010-08-18 14:23 ` [Bug fortran/45318] " rguenth at gcc dot gnu dot org
2010-08-18 17:44 ` burnus at gcc dot gnu dot org

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).