This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug treelang/33593] New: tree-outof-ssa moves sources of non-call exceptions past sequence points
- From: "rsandifo at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Sep 2007 19:01:24 -0000
- Subject: [Bug treelang/33593] New: tree-outof-ssa moves sources of non-call exceptions past sequence points
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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