diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-15 16:03:32 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-15 16:03:32 +0000 |
commit | 7e540e238b3018143f095898fc0aa1bba5bf7f9e (patch) | |
tree | 6eb52311efc6f806fde1125273865566759074cc /gcc/gimple.c | |
parent | 6c8b04816237fb79c71c7ab6938374d1e8e45d55 (diff) | |
download | gcc-7e540e238b3018143f095898fc0aa1bba5bf7f9e.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152850 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r-- | gcc/gimple.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c index 519b41cb9f0..1d6ef8fe612 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; |