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: Fix type descriptor for array with float length


This patch to the Go frontend fixes generating the type descriptor for
an array whose length is expressed as a floating point constant.  This
is permitted in Go as long as the actual value is an integer.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r 2691f158a34c go/types.cc
--- a/go/types.cc	Tue Jan 18 21:37:53 2011 -0800
+++ b/go/types.cc	Tue Jan 18 21:48:10 2011 -0800
@@ -4883,7 +4883,7 @@
 
   ++p;
   gcc_assert(p->field_name() == "len");
-  vals->push_back(this->length_);
+  vals->push_back(Expression::make_cast(p->type(), this->length_, bloc));
 
   ++p;
   gcc_assert(p == fields->end());

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