From: Ian Lance Taylor Date: Thu, 20 Mar 2014 19:37:50 +0000 (+0000) Subject: compiler: Consider the depth of a nested composite literal during traversal. X-Git-Tag: releases/gcc-4.9.0~369 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=207c82c407b6fe07c5768bf0542470f97bbd1a49;p=thirdparty%2Fgcc.git compiler: Consider the depth of a nested composite literal during traversal. Fixes issue 7590. From-SVN: r208731 --- diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 6ac18f570e86..643a233ba004 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -13483,6 +13483,20 @@ Composite_literal_expression::do_traverse(Traverse* traverse) { // The type may not be resolvable at this point. Type* type = this->type_; + + for (int depth = this->depth_; depth > 0; --depth) + { + if (type->array_type() != NULL) + type = type->array_type()->element_type(); + else if (type->map_type() != NULL) + type = type->map_type()->val_type(); + else + { + // This error will be reported during lowering. + return TRAVERSE_CONTINUE; + } + } + while (true) { if (type->classification() == Type::TYPE_NAMED)