aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-10-15 16:03:32 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-10-15 16:03:32 +0000
commit4c8160e78b39d879b01a838ab5bddc49f046816d (patch)
tree6eb52311efc6f806fde1125273865566759074cc
parentb8b6edc9d961e35c9fc46f0ebbc148b71ec81811 (diff)
downloadgcc-4c8160e78b39d879b01a838ab5bddc49f046816d.zip
gcc-4c8160e78b39d879b01a838ab5bddc49f046816d.tar.gz
gcc-4c8160e78b39d879b01a838ab5bddc49f046816d.tar.bz2
re PR lto/41669 (Infinite recursion trying to build gcc)
2009-10-15 Richard Guenther <rguenther@suse.de> PR lto/41669 * gimple.c (gimple_get_alias_set): Avoid recursing on invalid type topology. * gcc.dg/lto/20091015-1_0.c: New testcase. * gcc.dg/lto/20091015-1_1.c: Likewise. * gcc.dg/lto/20091015-1_2.c: Likewise. * gcc.dg/lto/20091015-1_a.h: Likewise. * gcc.dg/lto/20091015-1_b.h: Likewise. From-SVN: r152850
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gimple.c15
-rw-r--r--gcc/testsuite/ChangeLog9
-rw-r--r--gcc/testsuite/gcc.dg/lto/20091015-1_0.c5
-rw-r--r--gcc/testsuite/gcc.dg/lto/20091015-1_1.c4
-rw-r--r--gcc/testsuite/gcc.dg/lto/20091015-1_2.c5
-rw-r--r--gcc/testsuite/gcc.dg/lto/20091015-1_a.h2
-rw-r--r--gcc/testsuite/gcc.dg/lto/20091015-1_b.h2
8 files changed, 47 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c0d23fe..1a6cffe 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-15 Richard Guenther <rguenther@suse.de>
+
+ PR lto/41669
+ * gimple.c (gimple_get_alias_set): Avoid recursing on
+ invalid type topology.
+
2009-10-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
* config/spu/spu.c (get_branch_target): Use extract_asm_operands.
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 519b41c..1d6ef8f 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -4111,6 +4111,7 @@ gimple_signed_type (tree type)
alias_set_type
gimple_get_alias_set (tree t)
{
+ static bool recursing_p;
tree u;
/* Permit type-punning when accessing a union, provided the access
@@ -4152,6 +4153,12 @@ gimple_get_alias_set (tree t)
{
tree t1;
+ /* ??? We can end up creating cycles with TYPE_MAIN_VARIANT
+ and TYPE_CANONICAL. Avoid recursing endlessly between
+ this langhook and get_alias_set. */
+ if (recursing_p)
+ return -1;
+
/* Unfortunately, there is no canonical form of a pointer type.
In particular, if we have `typedef int I', then `int *', and
`I *' are different types. So, we have to pick a canonical
@@ -4176,7 +4183,13 @@ gimple_get_alias_set (tree t)
C++ committee. */
t1 = build_type_no_quals (t);
if (t1 != t)
- return get_alias_set (t1);
+ {
+ alias_set_type set;
+ recursing_p = true;
+ set = get_alias_set (t1);
+ recursing_p = false;
+ return set;
+ }
}
return -1;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 64dbee4..b54a6e0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2009-10-15 Richard Guenther <rguenther@suse.de>
+
+ PR lto/41669
+ * gcc.dg/lto/20091015-1_0.c: New testcase.
+ * gcc.dg/lto/20091015-1_1.c: Likewise.
+ * gcc.dg/lto/20091015-1_2.c: Likewise.
+ * gcc.dg/lto/20091015-1_a.h: Likewise.
+ * gcc.dg/lto/20091015-1_b.h: Likewise.
+
2009-10-15 Steve Ellcey <sje@cup.hp.com>
* gcc.dg/torture/pr41555.c: Add -std=c99 option.
diff --git a/gcc/testsuite/gcc.dg/lto/20091015-1_0.c b/gcc/testsuite/gcc.dg/lto/20091015-1_0.c
new file mode 100644
index 0000000..f60e7d1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20091015-1_0.c
@@ -0,0 +1,5 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-fPIC -shared -O2 -flto} {-fPIC -shared -O2 -fwhopr}} } */
+
+#include "20091015-1_b.h"
+void diagnostic_initialize (FILE **stream) { *stream = stderr; }
diff --git a/gcc/testsuite/gcc.dg/lto/20091015-1_1.c b/gcc/testsuite/gcc.dg/lto/20091015-1_1.c
new file mode 100644
index 0000000..c000518
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20091015-1_1.c
@@ -0,0 +1,4 @@
+#include "20091015-1_a.h"
+#include "20091015-1_b.h"
+void ggc_print_common_statistics (FILE *stream) {
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20091015-1_2.c b/gcc/testsuite/gcc.dg/lto/20091015-1_2.c
new file mode 100644
index 0000000..fd10680
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20091015-1_2.c
@@ -0,0 +1,5 @@
+#include "20091015-1_a.h"
+#include "20091015-1_b.h"
+void debug_optab_libfuncs (void) {
+foo (stderr, 4 );
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20091015-1_a.h b/gcc/testsuite/gcc.dg/lto/20091015-1_a.h
new file mode 100644
index 0000000..61e56c9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20091015-1_a.h
@@ -0,0 +1,2 @@
+struct _IO_FILE { int _flags;
+};
diff --git a/gcc/testsuite/gcc.dg/lto/20091015-1_b.h b/gcc/testsuite/gcc.dg/lto/20091015-1_b.h
new file mode 100644
index 0000000..8813902
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20091015-1_b.h
@@ -0,0 +1,2 @@
+typedef struct _IO_FILE FILE;
+extern struct _IO_FILE *stderr;