public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/33615]  New: Hoisting of potentially-throwing values for -fnon-call-exceptions
@ 2007-10-01 21:40 rsandifo at gcc dot gnu dot org
  2007-10-01 21:41 ` [Bug tree-optimization/33615] " rsandifo at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2007-10-01 21:40 UTC (permalink / raw)
  To: gcc-bugs

If the following C++ code is compiled with -fnon-call-exceptions,
the tree optimisers still hoist 1.0 / 0.0:

---------------------------------------------------------
extern volatile int y;

double
foo (double a, int x)
{
  while (x--)
    {
      y++;
      a += 1.0 / 0.0;
    }
  return a;
}
---------------------------------------------------------

Header copying ensures that 1.0 / 0.0 is only executed when the
incoming x is nonzero, but the division happens before the
assignment to "y".

At -O, the hoisting is done by LIM; at -O2, it's done be PRE.


-- 
           Summary: Hoisting of potentially-throwing values for -fnon-call-
                    exceptions
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rsandifo at gcc dot gnu dot org
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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


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

* [Bug tree-optimization/33615] Hoisting of potentially-throwing values for -fnon-call-exceptions
  2007-10-01 21:40 [Bug tree-optimization/33615] New: Hoisting of potentially-throwing values for -fnon-call-exceptions rsandifo at gcc dot gnu dot org
@ 2007-10-01 21:41 ` rsandifo at gcc dot gnu dot org
  2007-10-09 11:05 ` rsandifo at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2007-10-01 21:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rsandifo at gcc dot gnu dot org  2007-10-01 21:41 -------
I have a patch.


-- 

rsandifo at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rsandifo at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-10-01 21:41:11
               date|                            |


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


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

* [Bug tree-optimization/33615] Hoisting of potentially-throwing values for -fnon-call-exceptions
  2007-10-01 21:40 [Bug tree-optimization/33615] New: Hoisting of potentially-throwing values for -fnon-call-exceptions rsandifo at gcc dot gnu dot org
  2007-10-01 21:41 ` [Bug tree-optimization/33615] " rsandifo at gcc dot gnu dot org
  2007-10-09 11:05 ` rsandifo at gcc dot gnu dot org
@ 2007-10-09 11:05 ` rsandifo at gcc dot gnu dot org
  2007-10-09 11:10 ` rsandifo at gcc dot gnu dot org
  2007-12-03  4:29 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2007-10-09 11:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rsandifo at gcc dot gnu dot org  2007-10-09 11:05 -------
Subject: Bug 33615

Author: rsandifo
Date: Tue Oct  9 11:05:33 2007
New Revision: 129164

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129164
Log:
gcc/
        PR tree-optimization/33615
        * tree-ssa-pre.c (compute_avail): Don't call make_values_for_stmt
        if the statement might throw.  Fix formatting.

gcc/testsuite/
        PR tree-optimization/33615
        * g++.dg/tree-ssa/pr33615-2.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr33615-2.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-pre.c


-- 


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


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

* [Bug tree-optimization/33615] Hoisting of potentially-throwing values for -fnon-call-exceptions
  2007-10-01 21:40 [Bug tree-optimization/33615] New: Hoisting of potentially-throwing values for -fnon-call-exceptions rsandifo at gcc dot gnu dot org
  2007-10-01 21:41 ` [Bug tree-optimization/33615] " rsandifo at gcc dot gnu dot org
@ 2007-10-09 11:05 ` rsandifo at gcc dot gnu dot org
  2007-10-09 11:05 ` rsandifo at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2007-10-09 11:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rsandifo at gcc dot gnu dot org  2007-10-09 11:04 -------
Subject: Bug 33615

Author: rsandifo
Date: Tue Oct  9 11:04:46 2007
New Revision: 129163

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129163
Log:
gcc/
        PR tree-optimization/33615
        * tree-ssa-loop-im.c (movement_possibility): Return MOVE_IMPOSSIBLE
        if the rhs might throw.

gcc/testsuite/
        PR tree-optimization/33615
        * g++.dg/tree-ssa/pr33615.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr33615.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-loop-im.c


-- 


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


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

* [Bug tree-optimization/33615] Hoisting of potentially-throwing values for -fnon-call-exceptions
  2007-10-01 21:40 [Bug tree-optimization/33615] New: Hoisting of potentially-throwing values for -fnon-call-exceptions rsandifo at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-10-09 11:05 ` rsandifo at gcc dot gnu dot org
@ 2007-10-09 11:10 ` rsandifo at gcc dot gnu dot org
  2007-12-03  4:29 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2007-10-09 11:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rsandifo at gcc dot gnu dot org  2007-10-09 11:10 -------
Patches applied.  The consensus seemed to be that we need better
infrastructure.  The suggestions were:

  - set TREE_SIDE_EFFECTS for throwing expressions

  - add a new predicate for checking TREE_SIDE_EFFECTS, tree_could_throw_p,
    and others

  - make sure that throwing expressions end a bb even if they
    don't throw internally


-- 

rsandifo at gcc dot gnu dot org changed:

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


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


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

* [Bug tree-optimization/33615] Hoisting of potentially-throwing values for -fnon-call-exceptions
  2007-10-01 21:40 [Bug tree-optimization/33615] New: Hoisting of potentially-throwing values for -fnon-call-exceptions rsandifo at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-10-09 11:10 ` rsandifo at gcc dot gnu dot org
@ 2007-12-03  4:29 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-12-03  4:29 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2007-12-03  4:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-01 21:40 [Bug tree-optimization/33615] New: Hoisting of potentially-throwing values for -fnon-call-exceptions rsandifo at gcc dot gnu dot org
2007-10-01 21:41 ` [Bug tree-optimization/33615] " rsandifo at gcc dot gnu dot org
2007-10-09 11:05 ` rsandifo at gcc dot gnu dot org
2007-10-09 11:05 ` rsandifo at gcc dot gnu dot org
2007-10-09 11:10 ` rsandifo at gcc dot gnu dot org
2007-12-03  4:29 ` pinskia 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).