This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Go patch committed: Avoid crash with extra struct initializer


This patch to the Go frontend avoids a crash when there are extra values
for a struct initializer and the values types remain abstract.
Bootstrapped and tested on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian

diff -r b701c2857f59 go/expressions.cc
--- a/go/expressions.cc	Tue Jan 18 21:48:37 2011 -0800
+++ b/go/expressions.cc	Tue Jan 18 22:01:01 2011 -0800
@@ -10609,6 +10609,10 @@
 	  (*pv)->determine_type(&subcontext);
 	}
     }
+  // Extra values are an error we will report elsewhere; we still want
+  // to determine the type to avoid knockon errors.
+  for (; pv != this->vals_->end(); ++pv)
+    (*pv)->determine_type_no_context();
 }
 
 // Check types.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]