aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-08-17 18:04:35 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-08-17 18:04:35 +0000
commitf4fca9d48101c0a7e6073fb280e65f976f582811 (patch)
treedb2a4ef73c5f043aa93ea0f8a006dc3afbc40b11 /gcc
parent47fa5d230292f22802436d3f58af758795da3cbe (diff)
downloadgcc-f4fca9d48101c0a7e6073fb280e65f976f582811.zip
gcc-f4fca9d48101c0a7e6073fb280e65f976f582811.tar.gz
gcc-f4fca9d48101c0a7e6073fb280e65f976f582811.tar.bz2
compiler: Don't generate value reference in range clause if receiver is a sink.
The panic in test/fixedbugs/bug454.go was caused by the generation of an unnecessary var reference when writing a range value into a sink. If the receiving variable is a sink, there's no need to dereference a possible NULL pointer. Fixes Issue 24. From-SVN: r201815
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/parse.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index 429d91b..9d11285 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -5266,7 +5266,8 @@ Parse::range_clause_decl(const Typed_identifier_list* til,
no->var_value()->set_type_from_range_value();
if (is_new)
any_new = true;
- p_range_clause->value = Expression::make_var_reference(no, location);
+ if (!Gogo::is_sink_name(pti->name()))
+ p_range_clause->value = Expression::make_var_reference(no, location);
}
if (!any_new)