* Go patch committed: Don't crash when calling new on erroneous type
@ 2010-12-22 0:18 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2010-12-22 0:18 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 180 bytes --]
This patch to the Go frontend avoids a crash when calling new with an
erroneous type. Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu. Committed to mainline.
Ian
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: crash --]
[-- Type: text/x-diff, Size: 642 bytes --]
diff -r 36326cbb6279 go/expressions.cc
--- a/go/expressions.cc Tue Dec 21 15:11:44 2010 -0800
+++ b/go/expressions.cc Tue Dec 21 15:15:40 2010 -0800
@@ -10242,9 +10242,13 @@
Allocation_expression::do_get_tree(Translate_context* context)
{
tree type_tree = this->type_->get_tree(context->gogo());
+ if (type_tree == error_mark_node)
+ return error_mark_node;
tree size_tree = TYPE_SIZE_UNIT(type_tree);
tree space = context->gogo()->allocate_memory(this->type_, size_tree,
this->location());
+ if (space == error_mark_node)
+ return error_mark_node;
return fold_convert(build_pointer_type(type_tree), space);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-21 23:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-22 0:18 Go patch committed: Don't crash when calling new on erroneous type Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).