public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug treelang/33593] New: tree-outof-ssa moves sources of non-call exceptions past sequence points @ 2007-09-29 19:01 rsandifo at gcc dot gnu dot org 2007-09-29 19:05 ` [Bug tree-optimization/33593] " pinskia at gcc dot gnu dot org ` (5 more replies) 0 siblings, 6 replies; 7+ messages in thread From: rsandifo at gcc dot gnu dot org @ 2007-09-29 19:01 UTC (permalink / raw) To: gcc-bugs tree-outof-ssa can move potentially-trapping operations across what were sequence points, even when compiled with -fnon-call-exceptions. E.g., consider the following C++ code, compiled with -fnon-call-exceptions: ------------------------------------------------------------------------ #include <stdio.h> void foo (int) { printf ("Bar\n"); } int main (void) { int a = 1 / 0; printf ("Foo\n"); foo (a); } ------------------------------------------------------------------------ The tree optimisers themselves preserve the intent of the code, but tree-outof-ssa.c propogates the division into the call to foo(): ------------------------------------------------------------------------ int main() () { <bb 2>: __builtin_puts (&"Foo"[0]); foo (1 / 0); return 0; } ------------------------------------------------------------------------ So the unoptimised program behaves as expected, raising the divide-by-zero trap before printing "Foo". The optimised version prints "Foo" first. -- Summary: tree-outof-ssa moves sources of non-call exceptions past sequence points Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: treelang 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=33593 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/33593] tree-outof-ssa moves sources of non-call exceptions past sequence points 2007-09-29 19:01 [Bug treelang/33593] New: tree-outof-ssa moves sources of non-call exceptions past sequence points rsandifo at gcc dot gnu dot org @ 2007-09-29 19:05 ` pinskia at gcc dot gnu dot org 2007-09-29 19:05 ` rsandifo at gcc dot gnu dot org ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu dot org @ 2007-09-29 19:05 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from pinskia at gcc dot gnu dot org 2007-09-29 19:05 ------- 1 / 0; that does not aways trap. on ppc an undefined value is returned. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33593 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/33593] tree-outof-ssa moves sources of non-call exceptions past sequence points 2007-09-29 19:01 [Bug treelang/33593] New: tree-outof-ssa moves sources of non-call exceptions past sequence points rsandifo at gcc dot gnu dot org 2007-09-29 19:05 ` [Bug tree-optimization/33593] " pinskia at gcc dot gnu dot org @ 2007-09-29 19:05 ` rsandifo at gcc dot gnu dot org 2007-09-29 19:08 ` dnovillo at google dot com ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: rsandifo at gcc dot gnu dot org @ 2007-09-29 19:05 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from rsandifo at gcc dot gnu dot org 2007-09-29 19:05 ------- Assigning to Diego as he already has a patch (thanks!) -- rsandifo at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |dnovillo at google dot com |dot org | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33593 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/33593] tree-outof-ssa moves sources of non-call exceptions past sequence points 2007-09-29 19:01 [Bug treelang/33593] New: tree-outof-ssa moves sources of non-call exceptions past sequence points rsandifo at gcc dot gnu dot org 2007-09-29 19:05 ` [Bug tree-optimization/33593] " pinskia at gcc dot gnu dot org 2007-09-29 19:05 ` rsandifo at gcc dot gnu dot org @ 2007-09-29 19:08 ` dnovillo at google dot com 2007-09-29 19:08 ` pinskia at gcc dot gnu dot org ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: dnovillo at google dot com @ 2007-09-29 19:08 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from dnovillo at google dot com 2007-09-29 19:08 ------- Subject: Re: tree-outof-ssa moves sources of non-call exceptions past sequence points On 29 Sep 2007 19:05:20 -0000, pinskia at gcc dot gnu dot org <gcc-bugzilla@gcc.gnu.org> wrote: > 1 / 0; > > that does not aways trap. on ppc an undefined value is returned. In which case tree_could_trap_p() will/should return false on this expression then. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33593 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/33593] tree-outof-ssa moves sources of non-call exceptions past sequence points 2007-09-29 19:01 [Bug treelang/33593] New: tree-outof-ssa moves sources of non-call exceptions past sequence points rsandifo at gcc dot gnu dot org ` (2 preceding siblings ...) 2007-09-29 19:08 ` dnovillo at google dot com @ 2007-09-29 19:08 ` pinskia at gcc dot gnu dot org 2007-09-30 16:00 ` dnovillo at gcc dot gnu dot org 2008-02-03 14:36 ` steven at gcc dot gnu dot org 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu dot org @ 2007-09-29 19:08 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from pinskia at gcc dot gnu dot org 2007-09-29 19:08 ------- I think 1/0 should not be marked as throwing though as it is target dependent if it actually will trap or not. In fact as I mentioned on PPC, it does not trap. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33593 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/33593] tree-outof-ssa moves sources of non-call exceptions past sequence points 2007-09-29 19:01 [Bug treelang/33593] New: tree-outof-ssa moves sources of non-call exceptions past sequence points rsandifo at gcc dot gnu dot org ` (3 preceding siblings ...) 2007-09-29 19:08 ` pinskia at gcc dot gnu dot org @ 2007-09-30 16:00 ` dnovillo at gcc dot gnu dot org 2008-02-03 14:36 ` steven at gcc dot gnu dot org 5 siblings, 0 replies; 7+ messages in thread From: dnovillo at gcc dot gnu dot org @ 2007-09-30 16:00 UTC (permalink / raw) To: gcc-bugs ------- Comment #5 from dnovillo at gcc dot gnu dot org 2007-09-30 16:00 ------- Subject: Bug 33593 Author: dnovillo Date: Sun Sep 30 16:00:36 2007 New Revision: 128893 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128893 Log: PR 33593 * tree-ssa-ter.c (is_replaceable_p): Return false if STMT may throw an exception. testsuite/ChangeLog PR 33593 * g++.dg/tree-ssa/pr33593.C: New test. Added: trunk/gcc/testsuite/g++.dg/tree-ssa/pr33593.C Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-ter.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33593 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/33593] tree-outof-ssa moves sources of non-call exceptions past sequence points 2007-09-29 19:01 [Bug treelang/33593] New: tree-outof-ssa moves sources of non-call exceptions past sequence points rsandifo at gcc dot gnu dot org ` (4 preceding siblings ...) 2007-09-30 16:00 ` dnovillo at gcc dot gnu dot org @ 2008-02-03 14:36 ` steven at gcc dot gnu dot org 5 siblings, 0 replies; 7+ messages in thread From: steven at gcc dot gnu dot org @ 2008-02-03 14:36 UTC (permalink / raw) To: gcc-bugs ------- Comment #6 from steven at gcc dot gnu dot org 2008-02-03 14:35 ------- Should be fixed on the trunk. -- steven at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED Target Milestone|--- |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33593 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-02-03 14:36 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2007-09-29 19:01 [Bug treelang/33593] New: tree-outof-ssa moves sources of non-call exceptions past sequence points rsandifo at gcc dot gnu dot org 2007-09-29 19:05 ` [Bug tree-optimization/33593] " pinskia at gcc dot gnu dot org 2007-09-29 19:05 ` rsandifo at gcc dot gnu dot org 2007-09-29 19:08 ` dnovillo at google dot com 2007-09-29 19:08 ` pinskia at gcc dot gnu dot org 2007-09-30 16:00 ` dnovillo at gcc dot gnu dot org 2008-02-03 14:36 ` steven 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).