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

Submitted by Ian Taylor on Dec. 15, 2010, 11:56 p.m.

Details

Message ID mcrvd2uzj21.fsf@google.com
State New
Headers show

Commit Message

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 hide | download patch | download mbox

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;