aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2019-01-28 22:36:05 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-01-28 22:36:05 +0000
commitab1be99f2b005cb5b8b0b3caac19ab2edb0dd6f3 (patch)
tree9ee8260fd4a57b36069f9d59510577f1529f3f06
parent52bfbb69e7e888d8692597e649e9cedc7436083c (diff)
downloadgcc-ab1be99f2b005cb5b8b0b3caac19ab2edb0dd6f3.zip
gcc-ab1be99f2b005cb5b8b0b3caac19ab2edb0dd6f3.tar.gz
gcc-ab1be99f2b005cb5b8b0b3caac19ab2edb0dd6f3.tar.bz2
compiler: improve recursive type detection
Detect recursive type definition like "type T0 T1; type T1 T2; ...... type Tn T0". Fixes golang/go#25320. Reviewed-on: https://go-review.googlesource.com/c/159837 From-SVN: r268347
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/types.cc9
2 files changed, 10 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index faab230..4bdcf96 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-d67c4bf0c42b79d54925ba8c5f23278ee6c3efb6
+5ccb2d8593963e06ec3a35d362b384e82301d9f0
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index 5a45bb2..6d0c9a3 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -10259,6 +10259,15 @@ Find_type_use::type(Type* type)
break;
case Type::TYPE_NAMED:
+ if (type->named_type() == type->base()->named_type())
+ {
+ this->found_ = true;
+ return TRAVERSE_EXIT;
+ }
+ else
+ go_assert(saw_errors());
+ break;
+
case Type::TYPE_FORWARD:
go_assert(saw_errors());
break;