This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix tree-optimization/20920


Sigh.  Another SSA_NAME flowing through EH edges getting in the
way.

I'm starting to think that it would be much better to make these
SSA_NAME_OCCURS_IN_ABNORMAL_PHI into virtuals.  We would avoid
all the monkeying around that optimizers have to do.  It would
involve a bit of trickery because we only detect them when they
first go into SSA form, but it's doable.  Comments from EH folks?

Not committed yet.  Mainline is segfaulting somewhere in libjava
with and without my patch.  Somewhere in final code generation.
I still haven't looked hard.

Could anyone with access to a darwin machine test this patch for
me?


Thanks.  Diego.

-----------------------------------------------------------------------------
/home/cygnus/dnovillo/gcc.clean/native.x86_64/bld.torquemada/./gcc/gcj -B/home/c
ygnus/dnovillo/gcc.clean/native.x86_64/bld.torquemada/./gcc/ -B/home/cygnus/dnov
illo/gcc.clean/native.x86_64/x86_64-unknown-linux-gnu/bin/ -B/home/cygnus/dnovil
lo/gcc.clean/native.x86_64/x86_64-unknown-linux-gnu/lib/ -isystem /home/cygnus/d
novillo/gcc.clean/native.x86_64/x86_64-unknown-linux-gnu/include -isystem /home/
cygnus/dnovillo/gcc.clean/native.x86_64/x86_64-unknown-linux-gnu/sys-include -fi
ndirect-dispatch -B../.. -ffloat-store -fno-omit-frame-pointer -fclasspath= -fbo
otclasspath=/home/cygnus/dnovillo/gcc.clean/native.x86_64/bld.torquemada/x86_64-
unknown-linux-gnu/libjava:/home/cygnus/dnovillo/gcc.clean/src.x86_64/libjava/ext
ernal/sax:/home/cygnus/dnovillo/gcc.clean/src.x86_64/libjava:../.. --encoding=UT
F-8 -Wno-deprecated -g -O2 -c sax.jar -fPIC -o .libs/libsax_gcj_la-sax.o
org/xml/sax/helpers/ParserAdapter.java: In class 'org.xml.sax.helpers.ParserAdap
ter':
org/xml/sax/helpers/ParserAdapter.java: In constructor '()':
org/xml/sax/helpers/ParserAdapter.java:84: internal compiler error: Segmentation
 fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[5]: *** [libsax_gcj_la-sax.lo] Error 1
make[5]: Leaving directory `/notnfs/dnovillo/BLD-gcc.clean-native.torquemada.x86
_64/x86_64-unknown-linux-gnu/libjava/external/sax'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/notnfs/dnovillo/BLD-gcc.clean-native.torquemada.x86
_64/x86_64-unknown-linux-gnu/libjava/external/sax'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/notnfs/dnovillo/BLD-gcc.clean-native.torquemada.x86
_64/x86_64-unknown-linux-gnu/libjava/external'
make[2]: *** [all-recursive] Error 1
rm gnu/gcj/tools/gcj_dbtool/Main.class
make[2]: Leaving directory `/notnfs/dnovillo/BLD-gcc.clean-native.torquemada.x86
_64/x86_64-unknown-linux-gnu/libjava'
make[1]: *** [all-target-libjava] Error 2
make[1]: Leaving directory `/notnfs/dnovillo/BLD-gcc.clean-native.torquemada.x86
_64'
make: *** [bootstrap] Error 2
-----------------------------------------------------------------------------


	* tree-pretty-print.c (dump_generic_node): Show '(ab)' if an
	SSA_NAME flows through an abnormal edge.
	* tree-vrp.c (infer_value_range): Ignore SSA names that flow
	through abnormal edges.
	(maybe_add_assert_expr): Likewise.

testsuite/ChangeLog

	* g++.dg/tree-ssa/pr20920.C: New test.


Index: tree-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-pretty-print.c,v
retrieving revision 2.56
diff -d -u -p -r2.56 tree-pretty-print.c
--- tree-pretty-print.c	9 Apr 2005 01:37:23 -0000	2.56
+++ tree-pretty-print.c	10 Apr 2005 02:04:57 -0000
@@ -1416,6 +1416,8 @@ dump_generic_node (pretty_printer *buffe
       dump_generic_node (buffer, SSA_NAME_VAR (node), spc, flags, false);
       pp_string (buffer, "_");
       pp_decimal_int (buffer, SSA_NAME_VERSION (node));
+      if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
+	pp_string (buffer, "(ab)");
       break;
 
     case WITH_SIZE_EXPR:
Index: tree-vrp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vrp.c,v
retrieving revision 2.2
diff -d -u -p -r2.2 tree-vrp.c
--- tree-vrp.c	9 Apr 2005 16:43:31 -0000	2.2
+++ tree-vrp.c	10 Apr 2005 02:04:59 -0000
@@ -1280,6 +1280,11 @@ fp_predicate (tree expr)
 static tree
 infer_value_range (tree stmt, tree op)
 {
+  /* Do not attempt to infer anything in names that flow through
+     abnormal edges.  */
+  if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op))
+    return NULL_TREE;
+
   if (POINTER_TYPE_P (TREE_TYPE (op)))
     {
       bool is_store;
@@ -1504,6 +1509,12 @@ maybe_add_assert_expr (basic_block bb)
 	 sub-graphs or if they had been found in a block upstream from
 	 BB.  */
       op = USE_OP (uses, 0);
+
+      /* Do not attempt to infer anything in names that flow through
+	 abnormal edges.  */
+      if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op))
+	return false;
+
       RESET_BIT (found, SSA_NAME_VERSION (op));
 
       /* Look for uses of the operands in each of the sub-graphs
Index: testsuite/g++.dg/tree-ssa/pr20920.C
===================================================================
RCS file: testsuite/g++.dg/tree-ssa/pr20920.C
diff -N testsuite/g++.dg/tree-ssa/pr20920.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/g++.dg/tree-ssa/pr20920.C	10 Apr 2005 02:05:00 -0000
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* This was causing a failure in the out of SSA pass because VRP was
+   trying to insert assertions for SSA names that flow through
+   abnormal edges.  */
+void f(int) __attribute__((__noreturn__));
+int d(const char *);
+char * j ();
+
+char *
+foo (int x)
+{
+  char *path = __null;
+  try
+    {
+      path = j ();
+      if (path != __null)
+        if (d (path) != 0)
+          f (127);
+      f (127);
+    }
+  catch (...) { }
+
+  return path;
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]