Patchwork Go patch committed: Don't crash on Sizeof of undefined type

login
register
mail settings
Submitter Ian Taylor
Date Dec. 15, 2010, 11:56 p.m.
Message ID <mcrvd2uzj21.fsf@google.com>
Download mbox | patch
Permalink /patch/75705/
State New
Headers show

Comments

Ian Taylor - Dec. 15, 2010, 11:56 p.m.
This patch to the Go frontend avoids a crash when calling unsafe.Sizeof
on an undefined type.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

Patch

diff -r b35342ae6028 go/expressions.cc
--- a/go/expressions.cc	Wed Dec 15 15:47:53 2010 -0800
+++ b/go/expressions.cc	Wed Dec 15 15:52:50 2010 -0800
@@ -6722,7 +6722,7 @@ 
       if (arg == NULL)
 	return false;
       Type* arg_type = arg->type();
-      if (arg_type->is_error_type())
+      if (arg_type->is_error_type() || arg_type->is_undefined())
 	return false;
       if (arg_type->is_abstract())
 	return false;